diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index c39dc4b75f..c0b219cb4e 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -24,7 +24,7 @@ importers: '@visactor/vmind': 1.2.4-alpha.5 '@visactor/vrender': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': ~0.18.9 + '@visactor/vutils': ~0.18.10 '@vitejs/plugin-react': 3.1.0 axios: ^1.4.0 buble: ^0.20.0 @@ -57,7 +57,7 @@ importers: '@visactor/vmind': 1.2.4-alpha.5 '@visactor/vrender': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': 0.18.9 + '@visactor/vutils': 0.18.10 axios: 1.6.8 buble: 0.20.0 highlight.js: 11.9.0 @@ -139,7 +139,7 @@ importers: '@visactor/vgrammar-core': 0.13.11-alpha.3 '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': ~0.18.9 + '@visactor/vutils': ~0.18.10 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 eslint-config-prettier: 8.5.0 @@ -160,7 +160,7 @@ importers: '@visactor/vgrammar-core': 0.13.11-alpha.3 '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': 0.18.9 + '@visactor/vutils': 0.18.10 react-is: 18.3.1 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -204,7 +204,7 @@ importers: '@visactor/vgrammar-core': 0.13.11-alpha.3 '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': ~0.18.9 + '@visactor/vutils': ~0.18.10 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 eslint-config-prettier: 8.5.0 @@ -226,7 +226,7 @@ importers: '@visactor/vgrammar-core': 0.13.11-alpha.3 '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': 0.18.9 + '@visactor/vutils': 0.18.10 react-is: 18.3.1 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -359,7 +359,7 @@ importers: '@types/jest': ^26.0.0 '@types/node': '*' '@types/offscreencanvas': 2019.6.4 - '@visactor/vdataset': ~0.18.9 + '@visactor/vdataset': ~0.18.10 '@visactor/vgrammar-core': 0.13.11-alpha.3 '@visactor/vgrammar-hierarchy': 0.13.11-alpha.3 '@visactor/vgrammar-projection': 0.13.11-alpha.3 @@ -371,8 +371,8 @@ importers: '@visactor/vrender-components': 0.19.14 '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vscale': ~0.18.9 - '@visactor/vutils': ~0.18.9 + '@visactor/vscale': ~0.18.10 + '@visactor/vutils': ~0.18.10 '@visactor/vutils-extension': workspace:1.11.5 canvas: 2.11.2 cross-env: ^7.0.3 @@ -407,7 +407,7 @@ importers: typescript: 4.9.5 vite: 3.2.6 dependencies: - '@visactor/vdataset': 0.18.9 + '@visactor/vdataset': 0.18.10 '@visactor/vgrammar-core': 0.13.11-alpha.3 '@visactor/vgrammar-hierarchy': 0.13.11-alpha.3 '@visactor/vgrammar-projection': 0.13.11-alpha.3 @@ -419,8 +419,8 @@ importers: '@visactor/vrender-components': 0.19.14 '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vscale': 0.18.9 - '@visactor/vutils': 0.18.9 + '@visactor/vscale': 0.18.10 + '@visactor/vutils': 0.18.10 '@visactor/vutils-extension': link:../vutils-extension devDependencies: '@esbuild-plugins/node-globals-polyfill': 0.1.1 @@ -480,7 +480,7 @@ importers: '@visactor/vchart': workspace:1.11.5 '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': ~0.18.9 + '@visactor/vutils': ~0.18.10 '@vitejs/plugin-react': 3.1.0 canvas: 2.11.2 eslint: ~8.18.0 @@ -501,7 +501,7 @@ importers: '@visactor/vchart': link:../vchart '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': 0.18.9 + '@visactor/vutils': 0.18.10 devDependencies: '@internal/bundler': link:../../tools/bundler '@internal/eslint-config': link:../../share/eslint-config @@ -575,8 +575,8 @@ importers: '@types/jest': ^26.0.0 '@types/node': '*' '@types/offscreencanvas': 2019.6.4 - '@visactor/vdataset': ~0.18.9 - '@visactor/vutils': ~0.18.9 + '@visactor/vdataset': ~0.18.10 + '@visactor/vutils': ~0.18.10 eslint: ~8.18.0 husky: 7.0.4 jest: ^26.0.0 @@ -593,8 +593,8 @@ importers: typescript: 4.9.5 vite: 3.2.6 dependencies: - '@visactor/vdataset': 0.18.9 - '@visactor/vutils': 0.18.9 + '@visactor/vdataset': 0.18.10 + '@visactor/vutils': 0.18.10 devDependencies: '@internal/bundler': link:../../tools/bundler '@internal/eslint-config': link:../../share/eslint-config @@ -842,7 +842,7 @@ importers: '@visactor/vrender': 0.19.14 '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': ~0.18.9 + '@visactor/vutils': ~0.18.10 cross-env: ^7.0.3 eslint: ~8.18.0 jest: ^26.0.0 @@ -857,7 +857,7 @@ importers: '@visactor/vrender': 0.19.14 '@visactor/vrender-core': 0.19.14 '@visactor/vrender-kits': 0.19.14 - '@visactor/vutils': 0.18.9 + '@visactor/vutils': 0.18.10 devDependencies: '@internal/bundler': link:../bundler '@internal/eslint-config': link:../../share/eslint-config @@ -4750,28 +4750,6 @@ packages: topojson-client: 3.1.0 dev: false - /@visactor/vdataset/0.18.9: - resolution: {integrity: sha512-qQBOGKbB4W1+0aUQ95y9q4Nu56VAiC01Pijhkje0EUHpO8EIy17tUc0xtjpHE4iO8ym/02c4cGv4FKtuiewIrA==} - dependencies: - '@turf/flatten': 6.5.0 - '@turf/helpers': 6.5.0 - '@turf/rewind': 6.5.0 - '@visactor/vutils': 0.18.9 - d3-dsv: 2.0.0 - d3-geo: 1.12.1 - d3-hexbin: 0.2.2 - d3-hierarchy: 3.1.2 - eventemitter3: 4.0.7 - geobuf: 3.0.2 - geojson-dissolve: 3.1.0 - path-browserify: 1.0.1 - pbf: 3.2.1 - point-at-length: 1.1.0 - simple-statistics: 7.8.3 - simplify-geojson: 1.0.5 - topojson-client: 3.1.0 - dev: false - /@visactor/vgrammar-coordinate/0.13.11-alpha.3: resolution: {integrity: sha512-dWfhhP7YEeNigRbXmdinPCgrbpGYryNQDtE07DSjolAwbGc/RnlNr27FM8S6dvjFr9H26zJXvRndH7RRZe/F5Q==} dependencies: @@ -4920,12 +4898,6 @@ packages: '@visactor/vutils': 0.18.10 dev: false - /@visactor/vscale/0.18.9: - resolution: {integrity: sha512-rglOQQGhkamtjGtbFxY5pcfqsBXDyYU6NiQuBdVSeYRQvB9YpLLk455HpvQcEEhC+bRopNQsQgQV5276Pd0sfQ==} - dependencies: - '@visactor/vutils': 0.18.9 - dev: false - /@visactor/vutils/0.17.5: resolution: {integrity: sha512-HFN6Pk1Wc1RK842g02MeKOlvdri5L7/nqxMVTqxIvi0XMhHXpmoqN4+/9H+h8LmJpVohyrI/MT85TRBV/rManw==} dependencies: @@ -4942,14 +4914,6 @@ packages: eventemitter3: 4.0.7 dev: false - /@visactor/vutils/0.18.9: - resolution: {integrity: sha512-+CPwBATTQUPtXQ0KVXFRz8SCwAY9m5aR9QmtsVqya+mgaay3moFaAPNTbdkLBuZM5ewRYVcv/3fsDxuH+NXfFg==} - dependencies: - '@turf/helpers': 6.5.0 - '@turf/invariant': 6.5.0 - eventemitter3: 4.0.7 - dev: false - /@vitejs/plugin-react/3.1.0_vite@3.2.6: resolution: {integrity: sha512-AfgcRL8ZBhAlc3BFdigClmTUMISmmzHn7sB2h9U1odvc5U/MjWXsAaz18b/WoppUTDBzxOJwo2VdClfUcItu9g==} engines: {node: ^14.18.0 || >=16.0.0} diff --git a/docs/package.json b/docs/package.json index cfc181afae..1a97615c01 100644 --- a/docs/package.json +++ b/docs/package.json @@ -17,7 +17,7 @@ "@visactor/vchart": "workspace:1.11.5", "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", - "@visactor/vutils": "~0.18.9", + "@visactor/vutils": "~0.18.10", "@visactor/vrender": "0.19.14", "@visactor/vrender-kits": "0.19.14", "@visactor/vgrammar": "0.13.11-alpha.3", diff --git a/packages/openinula-vchart/package.json b/packages/openinula-vchart/package.json index c6fda6472e..4dda6f7711 100644 --- a/packages/openinula-vchart/package.json +++ b/packages/openinula-vchart/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@visactor/vchart": "workspace:1.11.5", - "@visactor/vutils": "~0.18.9", + "@visactor/vutils": "~0.18.10", "@visactor/vrender-core": "0.19.14", "@visactor/vrender-kits": "0.19.14", "@visactor/vgrammar-core": "0.13.11-alpha.3", diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index 2f5f4112ff..6d83ff686a 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@visactor/vchart": "workspace:1.11.5", - "@visactor/vutils": "~0.18.9", + "@visactor/vutils": "~0.18.10", "@visactor/vrender-core": "0.19.14", "@visactor/vrender-kits": "0.19.14", "@visactor/vgrammar-core": "0.13.11-alpha.3", diff --git a/packages/vchart-extension/package.json b/packages/vchart-extension/package.json index 2fc368f75a..d28ea9511c 100644 --- a/packages/vchart-extension/package.json +++ b/packages/vchart-extension/package.json @@ -22,7 +22,7 @@ "@visactor/vchart": "workspace:1.11.5", "@visactor/vrender-core": "0.19.14", "@visactor/vrender-kits": "0.19.14", - "@visactor/vutils": "~0.18.9" + "@visactor/vutils": "~0.18.10" }, "devDependencies": { "@internal/bundler": "workspace:*", diff --git a/packages/vchart/package.json b/packages/vchart/package.json index 2bb90a6e93..3e408610c0 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -116,9 +116,9 @@ "cross-env": "^7.0.3" }, "dependencies": { - "@visactor/vutils": "~0.18.9", - "@visactor/vdataset": "~0.18.9", - "@visactor/vscale": "~0.18.9", + "@visactor/vutils": "~0.18.10", + "@visactor/vdataset": "~0.18.10", + "@visactor/vscale": "~0.18.10", "@visactor/vrender-core": "0.19.14", "@visactor/vrender-kits": "0.19.14", "@visactor/vrender-components": "0.19.14", diff --git a/packages/vstory/package.json b/packages/vstory/package.json index 91c35c5773..7a33545db8 100644 --- a/packages/vstory/package.json +++ b/packages/vstory/package.json @@ -24,7 +24,7 @@ "@visactor/vrender-core": "0.19.14", "@visactor/vrender-kits": "0.19.14", "@visactor/vrender-components": "0.19.14", - "@visactor/vutils": "~0.18.9" + "@visactor/vutils": "~0.18.10" }, "devDependencies": { "@internal/bundler": "workspace:*", diff --git a/packages/vutils-extension/package.json b/packages/vutils-extension/package.json index 01597c8afa..aed681e444 100644 --- a/packages/vutils-extension/package.json +++ b/packages/vutils-extension/package.json @@ -22,8 +22,8 @@ "test-watch": "DEBUG_MODE=1 jest --watch" }, "dependencies": { - "@visactor/vutils": "~0.18.9", - "@visactor/vdataset": "~0.18.9" + "@visactor/vutils": "~0.18.10", + "@visactor/vdataset": "~0.18.10" }, "devDependencies": { "@internal/bundler": "workspace:*", @@ -64,4 +64,4 @@ "url": "https://www.visactor.io/" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/wx-vchart/miniprogram/src/vchart/index.js b/packages/wx-vchart/miniprogram/src/vchart/index.js index 308451ccf6..e6bf0151d3 100644 --- a/packages/wx-vchart/miniprogram/src/vchart/index.js +++ b/packages/wx-vchart/miniprogram/src/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&L.call(t,e);function I(t){let e;if(!p(t)||"object"!=typeof t)return t;const i=y(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=I(s)}return e}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?F(t,e,r,i):j(t,r,s[r])}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(V(t)!==V(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=N(t),n=N(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function et(t){return Number(t)}const it="undefined"!=typeof console;function st(t,e,i){const s=[e].concat([].slice.call(i));it&&console[t].apply(console,s)}var nt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(nt||(nt={}));class rt{static getInstance(t,e){return rt._instance&&S(t)?rt._instance.level(t):rt._instance||(rt._instance=new rt(t,e)),rt._instance}static setInstance(t){return rt._instance=t}static setInstanceLevel(t){rt._instance?rt._instance.level(t):rt._instance=new rt(t)}static clearInstance(){rt._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=nt.Info}canLogDebug(){return this._level>=nt.Debug}canLogError(){return this._level>=nt.Error}canLogWarn(){return this._level>=nt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):st(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Warn&&st(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Info&&st(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Debug&&st(this._method||"log","DEBUG",e),this}}function at(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;tt(t[n],e)>0?s=n:i=n+1}return i}rt._instance=null;const ot=(t,e)=>lt(0,t.length,(i=>e(t[i]))),lt=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ht=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(tt)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:et;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ct,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:dt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function pt(t,e,i,s){return t>e&&!ut(t,e,i,s)}function gt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var ft=function(t,e,i){return ti?i:t};var vt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let yt=!1;try{yt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){yt=!1}function bt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}yt=!1;const kt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mt=new RegExp(kt.source,"g");function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}const wt=1e-12,Ct=Math.PI,Et=Ct/2,Pt=2*Ct,Bt=2*Math.PI,Rt=Math.abs,Lt=Math.atan2,Ot=Math.cos,It=Math.max,Dt=Math.min,Ft=Math.sin,jt=Math.sqrt,zt=Math.pow;function Ht(t){return t>1?0:t<-1?Ct:Math.acos(t)}function Vt(t){return t>=1?Et:t<=-1?-Et:Math.asin(t)}function Nt(t,e,i,s,n){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Wt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Ut(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Yt(t,e){return Wt(t+e,10**Math.max(Ut(t),Ut(e)))}function Kt(t,e){return Wt(t-e,10**Math.max(Ut(t),Ut(e)))}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Xt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class $t{static distancePP(t,e){return jt(zt(t.x-e.x,2)+zt(t.y-e.y,2))}static distanceNN(t,e,i,s){return jt(zt(t-i,2)+zt(e-s,2))}static distancePN(t,e,i){return jt(zt(e-t.x,2)+zt(i-t.y,2))}static pointAtPP(t,e,i){return new Xt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function qt(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Zt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Zt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return qt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Jt extends Zt{}function Qt(t){return t*(Math.PI/180)}function te(t){return 180*t/Math.PI}const ee=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Pt;)t+=Pt;else if(t>0)for(;t>Pt;)t-=Pt;return t};function ie(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function se(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ne(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function re(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ne(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}class ae{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new ae,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new ae;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ae(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=te(r.rotateDeg),r}}class oe{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function le(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function he(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const ce=/^#([0-9a-f]{3,8})$/,de={transparent:4294967040},ue={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function pe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ge(t){return S(t)?new _e(t>>16,t>>8&255,255&t,1):y(t)?new _e(t[0],t[1],t[2]):new _e(255,255,255)}function me(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function fe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class ve{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ve(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ve(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof ve?t:new ve(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(p(de[t]))return function(t){return S(t)?new _e(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new _e(t[0],t[1],t[2],t[3]):new _e(255,255,255,1)}(de[t]);if(p(ue[t]))return ge(ue[t]);const e=`${t}`.trim().toLowerCase(),i=ce.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new _e((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ge(t):8===e?new _e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new _e(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=le(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new _e(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ve.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new _e(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=he(this.color.r,this.color.g,this.color.b),r=le(u(t)?n.h:ft(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new _e(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ce.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new _e((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?ge(s):8===n?new _e(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=ue[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new ve(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=me(t.color.r),this.color.g=me(t.color.g),this.color.b=me(t.color.b),this}copyLinearToSRGB(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class _e{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${pe(this.r)+pe(this.g)+pe(this.b)+(1===this.opacity?"":pe(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=he(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ye(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new _e(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:he});function xe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Se,Ae,ke,Me,Te,we,Ce,Ee;function Pe(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Re(t,e,i){return null===t?e:null===e?t:(Se=t.x1,Ae=t.x2,ke=t.y1,Me=t.y2,Te=e.x1,we=e.x2,Ce=e.y1,Ee=e.y2,i&&(Se>Ae&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),Te>we&&([Te,we]=[we,Te]),Ce>Ee&&([Ce,Ee]=[Ee,Ce])),Se>=we||Ae<=Te||ke>=Ee||Me<=Ce?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Se,Te),y1:Math.max(ke,Ce),x2:Math.min(Ae,we),y2:Math.min(Me,Ee)})}var Le;function Oe(t,e,i){return!(t&&e&&(i?(Se=t.x1,Ae=t.x2,ke=t.y1,Me=t.y2,Te=e.x1,we=e.x2,Ce=e.y1,Ee=e.y2,Se>Ae&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),Te>we&&([Te,we]=[we,Te]),Ce>Ee&&([Ce,Ee]=[Ee,Ce]),Se>we||AeEe||Mee.x2||t.x2e.y2||t.y2Ae&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),t.x>=Se&&t.x<=Ae&&t.y>=ke&&t.y<=Me):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function De(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Fe(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function je(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ze(t,e){const i=e?t.angle:Qt(t.angle),s=je(t);return[Fe({x:t.x1,y:t.y1},i,s),Fe({x:t.x2,y:t.y1},i,s),Fe({x:t.x2,y:t.y2},i,s),Fe({x:t.x1,y:t.y2},i,s)]}let He,Ve,Ne,Ge;function We(t){return He=1/0,Ve=1/0,Ne=-1/0,Ge=-1/0,t.forEach((t=>{He>t.x&&(He=t.x),Net.y&&(Ve=t.y),Gee&&r>s||rn?o:0}function $e(t,e){return Math.abs(t-e)0&&Ye(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Ze=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};class Je{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Je.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Je.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Je.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Je.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Je.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Je.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Je.NUMBERS_CHAR_SET="0123456789",Je.FULL_SIZE_CHAR="字";const Qe=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function ti(t){if(k(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ei(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function ii(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}const si=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();var ni=6371008.8,ri={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ni,kilometers:6371.0088,kilometres:6371.0088,meters:ni,metres:ni,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ni/1852,radians:1,yards:6967335.223679999};function ai(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function oi(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function li(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===Ie(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function hi(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=Qt(t[0]),r=Qt(t[1]),a=Qt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ri[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:te(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:te(l)}}class ci{static getInstance(){return ci.instance||(ci.instance=new ci),ci.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let ui;function pi(t,e){const i=di(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class gi{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const mi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fi(t){let e;if(e=mi.exec(t))return new gi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});rt.getInstance().error("invalid format: "+t)}const vi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class _i{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return _i.instance||(_i.instance=new _i),_i.instance}newFormat(t){const e=fi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):yi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=yi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?f:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?vi[8+ui/3]:"")+A+(t&&"("===n?")":""),m)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=fi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=di(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=vi[8+n/3];return function(t){return s(r*t)+a}}}const yi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>pi(100*t,e),r:pi,s:function(t,e){const i=di(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(ui=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+di(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function bi(){return new xi}function xi(){this.reset()}xi.prototype={constructor:xi,reset:function(){this.s=this.t=0},add:function(t){Ai(Si,t,this.t),Ai(this,Si.s,this.s),this.s?this.t+=Si.t:this.s=Si.t},valueOf:function(){return this.s}};var Si=new xi;function Ai(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var ki=1e-6,Mi=Math.PI,Ti=Mi/2,wi=Mi/4,Ci=2*Mi,Ei=180/Mi,Pi=Mi/180,Bi=Math.abs,Ri=Math.atan,Li=Math.atan2,Oi=Math.cos,Ii=Math.exp,Di=Math.log,Fi=Math.pow,ji=Math.sin,zi=Math.sign||function(t){return t>0?1:t<0?-1:0},Hi=Math.sqrt,Vi=Math.tan;function Ni(t){return t>1?0:t<-1?Mi:Math.acos(t)}function Gi(t){return t>1?Ti:t<-1?-Ti:Math.asin(t)}function Wi(){}function Ui(t,e){t&&Ki.hasOwnProperty(t.type)&&Ki[t.type](t,e)}var Yi={Feature:function(t,e){Ui(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sMi?t+Math.round(-t/Ci)*Ci:t,e]}function as(t,e,i){return(t%=Ci)?e||i?ns(ls(t),hs(e,i)):ls(t):e||i?hs(e,i):rs}function os(t){return function(e,i){return[(e+=t)>Mi?e-Ci:e<-Mi?e+Ci:e,i]}}function ls(t){var e=os(t);return e.invert=os(-t),e}function hs(t,e){var i=Oi(t),s=ji(t),n=Oi(e),r=ji(e);function a(t,e){var a=Oi(e),o=Oi(t)*a,l=ji(t)*a,h=ji(e),c=h*i+o*s;return[Li(l*n-c*r,o*i-h*s),Gi(c*n+l*r)]}return a.invert=function(t,e){var a=Oi(e),o=Oi(t)*a,l=ji(t)*a,h=ji(e),c=h*n-l*r;return[Li(l*n+h*r,o*i+c*s),Gi(c*i-o*s)]},a}function cs(t,e){(e=Ji(e))[0]-=t,ss(e);var i=Ni(-e[1]);return((-e[2]<0?-i:i)+Ci-ki)%Ci}function ds(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Wi,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function us(t,e){return Bi(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function ms(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function xs(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function Ss(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ds(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=xs(a);var t=function(t,e){var i=ys(e),s=e[1],n=ji(s),r=[ji(i),-Oi(i),0],a=0,o=0;_s.reset(),1===n?s=Ti+ki:-1===n&&(s=-Ti-ki);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Mi,w=m*x;if(_s.add(Li(w*k*ji(M),f*S+w*Oi(M))),a+=T?A+k*Ci:A,T^p>=i^y>=i){var C=ts(Ji(u),Ji(_));ss(C);var E=ts(r,C);ss(E);var P=(T^A>=0?-1:1)*Gi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-ki||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(As))}return u}}function As(t){return t.length>1}function ks(t,e){return((t=t.x)[0]<0?t[1]-Ti-ki:Ti-t[1])-((e=e.x)[0]<0?e[1]-Ti-ki:Ti-e[1])}1===(fs=bs).length&&(vs=fs,fs=function(t,e){return bs(vs(t),e)});var Ms=Ss((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Mi:-Mi,l=Bi(r-i);Bi(l-Mi)0?Ti:-Ti),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Mi&&(Bi(i-n)ki?Ri((ji(e)*(r=Oi(s))*ji(i)-ji(s)*(n=Oi(e))*ji(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Ti,s.point(-Mi,n),s.point(0,n),s.point(Mi,n),s.point(Mi,0),s.point(Mi,-n),s.point(0,-n),s.point(-Mi,-n),s.point(-Mi,0),s.point(-Mi,n);else if(Bi(t[0]-e[0])>ki){var r=t[0]0,n=Bi(e)>ki;function r(t,i){return Oi(t)*Oi(i)>e}function a(t,i,s){var n=[1,0,0],r=ts(Ji(t),Ji(i)),a=Qi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ts(n,r),u=is(n,h);es(u,is(r,c));var p=d,g=Qi(u,p),m=Qi(p,p),f=g*g-m*(Qi(u,u)-1);if(!(f<0)){var v=Hi(f),_=is(p,(-g-v)/m);if(es(_,u),_=Zi(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Bi(_[0]-b)Mi^(b<=_[0]&&_[0]<=x)){var T=is(p,(-g+v)/m);return es(T,u),[_,Zi(T)]}}}function o(e,i){var n=s?t:Mi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ss(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Mi:-Mi),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||us(e,p)||us(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&us(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Oi(e),o=ji(e),l=s*i;null==n?(n=e+s*Ci,r=e-l/2):(n=cs(a,n),r=cs(a,r),(s>0?nr)&&(n+=s*Ci));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Bi(s[0]-t)0?0:3:Bi(s[0]-i)0?2:1:Bi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=ds(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(A(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=xs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&gs(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function A(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Cs,Math.min(ws,g)),m=Math.max(Cs,Math.min(ws,m))],b=[r=Math.max(Cs,Math.min(ws,r)),a=Math.max(Cs,Math.min(ws,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Ps(t){return t}var Bs,Rs,Ls,Os,Is=bi(),Ds=bi(),Fs={point:Wi,lineStart:Wi,lineEnd:Wi,polygonStart:function(){Fs.lineStart=js,Fs.lineEnd=Vs},polygonEnd:function(){Fs.lineStart=Fs.lineEnd=Fs.point=Wi,Is.add(Bi(Ds)),Ds.reset()},result:function(){var t=Is/2;return Is.reset(),t}};function js(){Fs.point=zs}function zs(t,e){Fs.point=Hs,Bs=Ls=t,Rs=Os=e}function Hs(t,e){Ds.add(Os*t-Ls*e),Ls=t,Os=e}function Vs(){Hs(Bs,Rs)}var Ns=Fs,Gs=1/0,Ws=Gs,Us=-Gs,Ys=Us;var Ks,Xs,$s,qs,Zs={point:function(t,e){tUs&&(Us=t);eYs&&(Ys=e)},lineStart:Wi,lineEnd:Wi,polygonStart:Wi,polygonEnd:Wi,result:function(){var t=[[Gs,Ws],[Us,Ys]];return Us=Ys=-(Ws=Gs=1/0),t}},Js=0,Qs=0,tn=0,en=0,sn=0,nn=0,rn=0,an=0,on=0,ln={point:hn,lineStart:cn,lineEnd:pn,polygonStart:function(){ln.lineStart=gn,ln.lineEnd=mn},polygonEnd:function(){ln.point=hn,ln.lineStart=cn,ln.lineEnd=pn},result:function(){var t=on?[rn/on,an/on]:nn?[en/nn,sn/nn]:tn?[Js/tn,Qs/tn]:[NaN,NaN];return Js=Qs=tn=en=sn=nn=rn=an=on=0,t}};function hn(t,e){Js+=t,Qs+=e,++tn}function cn(){ln.point=dn}function dn(t,e){ln.point=un,hn($s=t,qs=e)}function un(t,e){var i=t-$s,s=e-qs,n=Hi(i*i+s*s);en+=n*($s+t)/2,sn+=n*(qs+e)/2,nn+=n,hn($s=t,qs=e)}function pn(){ln.point=hn}function gn(){ln.point=fn}function mn(){vn(Ks,Xs)}function fn(t,e){ln.point=vn,hn(Ks=$s=t,Xs=qs=e)}function vn(t,e){var i=t-$s,s=e-qs,n=Hi(i*i+s*s);en+=n*($s+t)/2,sn+=n*(qs+e)/2,nn+=n,rn+=(n=qs*t-$s*e)*($s+t),an+=n*(qs+e),on+=3*n,hn($s=t,qs=e)}var _n=ln;function yn(t){this._context=t}yn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ci)}},result:Wi};var bn,xn,Sn,An,kn,Mn=bi(),Tn={point:Wi,lineStart:function(){Tn.point=wn},lineEnd:function(){bn&&Cn(xn,Sn),Tn.point=Wi},polygonStart:function(){bn=!0},polygonEnd:function(){bn=null},result:function(){var t=+Mn;return Mn.reset(),t}};function wn(t,e){Tn.point=Cn,xn=An=t,Sn=kn=e}function Cn(t,e){An-=t,kn-=e,Mn.add(Hi(An*An+kn*kn)),An=t,kn=e}var En=Tn;function Pn(){this._string=[]}function Bn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Rn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),qi(t,i(s))),s.result()}return r.area=function(t){return qi(t,i(Ns)),Ns.result()},r.measure=function(t){return qi(t,i(En)),En.result()},r.bounds=function(t){return qi(t,i(Zs)),Zs.result()},r.centroid=function(t){return qi(t,i(_n)),_n.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ps):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Pn):new yn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Ln(t){return function(e){var i=new On;for(var s in t)i[s]=t[s];return i.stream=e,i}}function On(){}function In(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),qi(i,t.stream(Zs)),e(Zs.result()),null!=s&&t.clipExtent(s),t}function Dn(t,e,i){return In(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Fn(t,e,i){return Dn(t,[[0,0],e],i)}function jn(t,e,i){return In(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function zn(t,e,i){return In(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Pn.prototype={_radius:4.5,_circle:Bn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Bn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},On.prototype={constructor:On,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Hn=16,Vn=Oi(30*Pi);function Nn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,A=Hi(b*b+x*x+S*S),k=Gi(S/=A),M=Bi(Bi(S)-1)e||Bi((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Pi:0,E()):[f*Ei,v*Ei,_*Ei]},w.angle=function(t){return arguments.length?(y=t%360*Pi,E()):y*Ei},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=Nn(o,T=t*t),P()):Hi(T)},w.fitExtent=function(t,e){return Dn(w,t,e)},w.fitSize=function(t,e){return Fn(w,t,e)},w.fitWidth=function(t,e){return jn(w,t,e)},w.fitHeight=function(t,e){return zn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function Xn(t){var e=0,i=Mi/3,s=Kn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Pi,i=t[1]*Pi):[e*Ei,i*Ei]},n}function $n(t,e){var i=ji(t),s=(i+ji(e))/2;if(Bi(s)2?t[2]*Pi:0),e.invert=function(e){return(e=t.invert(e[0]*Pi,e[1]*Pi))[0]*=Ei,e[1]*=Ei,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===ir?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function nr(t){return Vi((Ti+t)/2)}function rr(t,e){var i=Oi(t),s=t===e?ji(t):Di(i/Oi(e))/Di(nr(e)/nr(t)),n=i*Fi(nr(t),s)/s;if(!s)return ir;function r(t,e){n>0?e<-Ti+ki&&(e=-Ti+ki):e>Ti-ki&&(e=Ti-ki);var i=n/Fi(nr(e),s);return[i*ji(s*t),n-i*Oi(s*t)]}return r.invert=function(t,e){var i=n-e,r=zi(s)*Hi(t*t+i*i),a=Li(t,Bi(i))*zi(i);return i*s<0&&(a-=Mi*zi(t)*zi(i)),[a/s,2*Ri(Fi(n/r,1/s))-Ti]},r}function ar(t,e){return[t,e]}function or(t,e){var i=Oi(t),s=t===e?ji(t):(i-Oi(e))/(e-t),n=i/s+t;if(Bi(s)ki&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},fr.invert=Qn(Gi),vr.invert=Qn((function(t){return 2*Ri(t)})),_r.invert=function(t,e){return[-e,2*Ri(Ii(t))-Ti]};var xr={exports:{}},Sr=function(t,e){this.p1=t,this.p2=e};Sr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Sr.prototype.run=function(){return this.p2[0]-this.p1[0]},Sr.prototype.slope=function(){return this.rise()/this.run()},Sr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Sr.prototype.isVertical=function(){return!isFinite(this.slope())},Sr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Sr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Sr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Sr.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},Sr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ar=Sr,kr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ar(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=kr(t.slice(0,s),e),o=kr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Mr=kr;!function(t){var e=Mr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=wr(Pr,e),{tolerance:s}=i;return Tr(t,s)};var Rr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Rr||(Rr={}));const Lr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+jr(e,6):jr(e,4))+"-"+jr(t.getUTCMonth()+1,2)+"-"+jr(t.getUTCDate(),2)+(r?"T"+jr(i,2)+":"+jr(s,2)+":"+jr(n,2)+"."+jr(r,3)+"Z":n?"T"+jr(i,2)+":"+jr(s,2)+":"+jr(n,2)+"Z":s||i?"T"+jr(i,2)+":"+jr(s,2)+"Z":"")}function Hr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ir;if(h)return h=!1,Or;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Rr.DSV;const i=wr(Gr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Hr(s).parse(t)},Ur=function(t){return(arguments.length>2?arguments[2]:void 0).type=Rr.DSV,Vr(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Rr.DSV,Nr(t)};function Kr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Xr(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Xr(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return qr(t);default:throw new Error("unknown GeoJSON type")}}function Xr(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=$r(t.properties),e.geometry=qr(t.geometry),e}function $r(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=$r(s):e[i]=s})),e):e}function qr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return qr(t)})),e):(e.coordinates=Zr(t.coordinates),e)}function Zr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Zr(t)}))}function Jr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Qr(t){for(var e,i,s=Jr(t),n=0,r=1;r0}function ta(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Kr(t));var r=[];switch(t.type){case"GeometryCollection":return ea(t,(function(t){sa(t,s)})),t;case"FeatureCollection":return ta(t,(function(t){ta(sa(t,s),(function(t){r.push(t)}))})),oi(r)}return sa(t,s)}function sa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ea(t,(function(t){sa(t,e)})),t;case"LineString":return na(Jr(t),e),t;case"Polygon":return ra(Jr(t),e),t;case"MultiLineString":return Jr(t).forEach((function(t){na(t,e)})),t;case"MultiPolygon":return Jr(t).forEach((function(t){ra(t,e)})),t;case"Point":case"MultiPoint":return t}}function na(t,e){Qr(t)===e&&t.reverse()}function ra(t,e){Qr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=aa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ca=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Rr.GEO;const i=wr(la,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ha(t))})):e.push(ha(t))})),e})(t);let o=t.features;return a&&(o=ia(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=oa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=oa.bounds(t);t.bbox=e}})),t.features=o,t},da={},ua=(t,e,i)=>{i.type=Rr.GEO;const s=wr(la,da,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return br(a,t)}))}:br(a,o));var a,o;return ca(r,s,i)},pa=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ga=0;function ma(){return ga>1e8&&(ga=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ga++}class fa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ma("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:rt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const va="_data-view-diff-rank";class _a{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ma("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[va]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[va]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[va]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Lr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ya{static GenAutoIncrementId(){return ya.auto_increment_id++}}ya.auto_increment_id=0;class ba{constructor(t){this.id=ya.GenAutoIncrementId(),this.registry=t}}const xa="named",Sa="inject",Aa="multi_inject",ka="inversify:tagged",Ma="inversify:paramtypes";class Ta{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===xa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var wa=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ca(e,0,s,t)}}function Pa(t){return e=>(i,s,n)=>Ea(new Ta(t,e))(i,s,n)}const Ba=Pa(Sa),Ra=Pa(Aa);function La(){return function(t){return wa.defineMetadata(Ma,null,t),t}}function Oa(t){return Ea(new Ta(xa,t))}const Ia="Singleton",Da="Transient",Fa="ConstantValue",ja="DynamicValue",za="Factory",Ha="Function",Va="Instance",Na="Invalid";class Ga{constructor(t,e){this.id=ya.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Na,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Ga(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ia&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Wa{getConstructorMetadata(t){return{compilerGeneratedMetadata:wa.getMetadata(Ma,t),userGeneratedMetadata:wa.getMetadata(ka,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ua=(Ya=xa,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ya&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const $a=Symbol("ContributionProvider");class qa{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Za(t,e){t($a).toDynamicValue((t=>{let{container:i}=t;return new qa(e,i)})).inSingletonScope().whenTargetNamed(e)}class Ja{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class Qa extends Ja{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const to=Symbol.for("EnvContribution"),eo=Symbol.for("VGlobal");var io=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},so=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},no=function(t,e){return function(i,s){e(i,s,t)}};let ro=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ya.GenAutoIncrementId(),this.hooks={onSetEnv:new Qa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ro=io([La(),no(0,Ba($a)),no(0,Oa(to)),so("design:paramtypes",[Object])],ro);const ao=Pt-1e-8;class oo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>ao)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Pt)<0&&(s+=Pt),(n%=Pt)<0&&(n+=Pt),nn;++o,a-=Et)g(a);else for(a=s-s%Et+Et,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ho=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,co={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},uo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let po,go,mo,fo,vo,_o;var yo,bo,xo,So,Ao,ko,Mo,To,wo;function Co(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,A=i+f,k=S+y*f,M=A-y*m;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Eo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=Qt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Pt:C>0&&0===r&&(C-=Pt);const E=Math.ceil(Math.abs(C/(Et+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Ro(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class No extends Vo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Go(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Wo(t,e,i){const s=null!=e?e:Rt(i[i.length-1].x-i[0].x)>Rt(i[i.length-1].y-i[0].y)?Mo.ROW:Mo.COLUMN;return"monotoneY"===t?new No(t,s):new Vo(t,s)}class Uo{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Yo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return function(t,e){Go(t,e)}(new Uo(n,s),t),n}function Ko(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Xo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Ko(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Ko(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function $o(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Yo(t,e);const n=Wo("basis",i,t);return function(t,e){Go(t,e)}(new Xo(n,s),t),n}function qo(t){return t<0?-1:1}function Zo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(qo(r)+qo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Jo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Qo(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class tl{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Qo(this,this._t0,Jo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Qo(this,Jo(this,e=Zo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Qo(this,this._t0,e=Zo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class el extends tl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function il(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Yo(t,e);const n=Wo("monotoneX",i,t);return function(t,e){Go(t,e)}(new tl(n,s),t),n}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Yo(t,e);const n=Wo("monotoneY",i,t);return function(t,e){Go(t,e)}(new el(n,s),t),n}let nl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function rl(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Vo("step",null!=s?s:Rt(t[t.length-1].x-t[0].x)>Rt(t[t.length-1].y-t[0].y)?Mo.ROW:Mo.COLUMN);return function(t,e){Go(t,e)}(new nl(r,e,n),t),r}class al extends Uo{lineEnd(){this.context.closePath()}}function ol(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return function(t,e){Go(t,e)}(new al(n,s),t),n}function ll(t,e,i){switch(e){case"linear":default:return Yo(t,i);case"basis":return $o(t,i);case"monotoneX":return il(t,i);case"monotoneY":return sl(t,i);case"step":return rl(t,.5,i);case"stepBefore":return rl(t,0,i);case"stepAfter":return rl(t,1,i);case"linearClosed":return ol(t,i)}}class hl extends lo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new oo(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([uo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([uo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([uo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([uo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([uo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([uo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([uo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([uo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([uo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[uo.M]=t=>`M${t[1]} ${t[2]}`,t[uo.L]=t=>`L${t[1]} ${t[2]}`,t[uo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[uo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[uo.A]=t=>{const e=[];Po(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[uo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;t_o){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Ro(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Mo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.y-e.p1.y)}if(this.direction===Mo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const cl=["l",0,0,0,0,0,0,0];function dl(t,e,i){const s=cl[0]=t[0];if("a"===s||"A"===s)cl[1]=e*t[1],cl[2]=i*t[2],cl[3]=t[3],cl[4]=t[4],cl[5]=t[5],cl[6]=e*t[6],cl[7]=i*t[7];else if("h"===s||"H"===s)cl[1]=e*t[1];else if("v"===s||"V"===s)cl[1]=i*t[1];else for(let s=1,n=t.length;s{rt.getInstance().warn("空函数")}}),wl=Object.assign(Object.assign({},yl),{points:[],cornerRadius:0,closePath:!0}),Cl=Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const El=Object.assign(Object.assign({},yl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},yl),fl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},yl),fl),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Rl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yl),{fill:!0,cornerRadius:0}),Ll=Object.assign(Object.assign({},Rl),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const Ol=new class{},Il={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Dl=!0,Fl=!1,jl=/\w|\(|\)|-/,zl=/[.?!,;:/,。?!、;:]/,Hl=/\S/;function Vl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Ol.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Nl(t,a)),a}function Nl(t,e){let i=e;for(;jl.test(t[i-1])&&jl.test(t[i])||zl.test(t[i]);)if(i--,i<=0)return e;return i}function Gl(t,e){const i=Ol.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var Wl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ul=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Pl.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=Nl(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Nl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Ul=Wl([La()],Ul);var Yl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Kl=Symbol.for("TextMeasureContribution");let Xl=class extends Ul{};Xl=Yl([La()],Xl);const $l=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Da,this.options=e,this.id=ya.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Wa}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,xa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Ga(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Xa(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[Sa],multiInject:s[Aa]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Fa:case Ha:e=t.cache;break;case Va:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ia&&(t.cache=e,t.activated=!0)}},ql=Symbol.for("CanvasFactory"),Zl=Symbol.for("Context2dFactory");function Jl(t){return $l.getNamed(ql,Ol.global.env)(t)}const Ql=1e-4,th=Math.sqrt(3),eh=1/3;function ih(t){return t>-fh&&tfh||t<-fh}const nh=[0,0],rh=[0,0],ah=[0,0];function oh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function lh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function hh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function ch(t){return(t%=Bt)<0&&(t+=Bt),t}function dh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function uh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Bt);let d=Math.atan2(l,o);return d<0&&(d+=Bt),d>=s&&d<=n||d+Bt>=s&&d+Bt<=n}function mh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(ih(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const _h=[-1,-1,-1],yh=[-1,-1];function bh(){const t=yh[0];yh[0]=yh[1],yh[1]=t}function xh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(ih(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,eh):Math.pow(i,eh),s=s<0?-Math.pow(-s,eh):Math.pow(s,eh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+th*Math.sin(e)))/(3*a),h=(-o+i*(s-th*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,_h);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&bh(),p=hh(e,s,r,o,yh[0]),u>1&&(g=hh(e,s,r,o,yh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(ih(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,_h);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=lh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);_h[0]=-l,_h[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Bt-1e-4){s=0,n=Bt;const e=r?1:-1;return a>=_h[0]+t&&a<=_h[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Bt,n+=Bt);let c=0;for(let e=0;e<2;e++){const i=_h[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Bt+t),(t>=s&&t<=n||t+Bt>=s&&t+Bt<=n)&&(t>Ct/2&&t<1.5*Ct&&(e=-e),c+=e)}}return c}function kh(t){return Math.round(t/Ct*1e8)/1e8%2*Ct}function Mh(t,e){let i=kh(t[0]);i<0&&(i+=Bt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Bt?n=i+Bt:e&&i-n>=Bt?n=i-Bt:!e&&i>n?n=i+(Bt-kh(i-n)):e&&i1&&(i||(h+=dh(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;Th[0]=S,Th[1]=A,Mh(Th,Boolean(a[6])),S=Th[0],A=Th[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-f)*_/_+f;switch(m){case uo.M:u=f,p=v,c=u,d=p;break;case uo.L:if(i){if(mh(c,d,f,v,e,s,n))return!0}else h+=dh(c,d,f,v,s,n)||0;c=f,d=v;break;case uo.C:if(i){if(ph(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=xh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case uo.Q:if(i){if(uh(c,d,f,v,_,y,e,s,n))return!0}else h+=Sh(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case uo.A:if(o=Math.cos(k)*_+f,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=dh(c,d,o,l,s,n),i){if(gh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=Ah(f,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+f,d=Math.sin(k+M)*_+v;break;case uo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(mh(u,p,o,p,e,s,n)||mh(o,p,o,l,e,s,n)||mh(o,l,u,l,e,s,n)||mh(u,l,u,p,e,s,n))return!0}else h+=dh(o,p,o,l,s,n),h+=dh(u,l,u,p,s,n);break;case uo.Z:if(i){if(mh(c,d,u,p,e,s,n))return!0}else h+=dh(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ph=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bh=Symbol.for("VWindow"),Rh=Symbol.for("WindowHandlerContribution");let Lh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new Qa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&($l.getNamed(Rh,t.env).configure(this,t),this.actived=!0)},this._uid=ya.GenAutoIncrementId(),this.global=Ol.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Lh=Eh([La(),Ph("design:paramtypes",[])],Lh);var Oh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dh=function(t,e){return function(i,s){e(i,s,t)}};let Fh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ol.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Ch.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:fl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Je(Object.assign({defaultFontParams:{fontFamily:fl.fontFamily,fontSize:fl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Je.ALPHABET_CHAR_SET+Je.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=$l.get(Bh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var jh;Fh=Oh([La(),Dh(0,Ba($a)),Dh(0,Oa(Kl)),Ih("design:paramtypes",[Object])],Fh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(jh||(jh={}));const zh=new ae;let Hh=class{constructor(){this.matrix=new ae}init(t){return this.mode=jh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=jh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(zh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(zh.a,zh.b,zh.c,zh.d,zh.e,zh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(zh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(zh.a,zh.b,zh.c,zh.d,zh.e,zh.f),this}scale(t,e,i){return this.mode===jh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===jh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return zh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(zh.a,zh.b,zh.c,zh.d,zh.e,zh.f),this}translate(t,e){return this.mode===jh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===jh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Hh=Oh([La(),Ih("design:paramtypes",[])],Hh);const Vh={arc:bl,area:xl,circle:Sl,line:Ml,path:Tl,symbol:El,text:Pl,rect:Cl,polygon:wl,richtext:Bl,richtextIcon:Ll,image:Rl,group:Al,glyph:kl},Nh=Object.keys(Vh);function Gh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Wh={arc:Object.assign({},Vh.arc),area:Object.assign({},Vh.area),circle:Object.assign({},Vh.circle),line:Object.assign({},Vh.line),path:Object.assign({},Vh.path),symbol:Object.assign({},Vh.symbol),text:Object.assign({},Vh.text),rect:Object.assign({},Vh.rect),polygon:Object.assign({},Vh.polygon),richtext:Object.assign({},Vh.richtext),richtextIcon:Object.assign({},Vh.richtextIcon),image:Object.assign({},Vh.image),group:Object.assign({},Vh.group),glyph:Object.assign({},Vh.glyph)};class Uh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Nh.forEach((t=>{this._defaultTheme[t]=Object.create(Wh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,rt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Nh.forEach((s=>{const n=Object.create(Wh[s]);t&&t[s]&&Gh(n,t[s]),i[s]&&Gh(n,i[s]),e[s]&&Gh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Nh.forEach((t=>{Gh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Yh=new Uh;function Kh(t,e){return t.glyphHost?Kh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Yh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Kh(t.attachedThemeGraphic)||Yh.getTheme()}var Xh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class $h extends l{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=ya.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Xh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&rt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof Jh))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(ic(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Jh))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=ic(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Jh))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=ic(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Jh))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=ic(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Jh))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ec.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ic(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(ic(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,ic(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Jh))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):ic(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Qh))return void rt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ec.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new sc(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Jh,this.rootWheelEvent=new Qh,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class oc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return oc.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class lc{static Avaliable(){return!0}avaliable(){return lc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class hc{static Avaliable(){return!!Ol.global.getRequestAnimationFrame()}avaliable(){return hc.Avaliable()}tick(t,e){Ol.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var cc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(cc||(cc={}));class dc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-dc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*dc.bounceIn(2*t):.5*dc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Bt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Bt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Bt/e)*.5+1}}}dc.quadIn=dc.getPowIn(2),dc.quadOut=dc.getPowOut(2),dc.quadInOut=dc.getPowInOut(2),dc.cubicIn=dc.getPowIn(3),dc.cubicOut=dc.getPowOut(3),dc.cubicInOut=dc.getPowInOut(3),dc.quartIn=dc.getPowIn(4),dc.quartOut=dc.getPowOut(4),dc.quartInOut=dc.getPowInOut(4),dc.quintIn=dc.getPowIn(5),dc.quintOut=dc.getPowOut(5),dc.quintInOut=dc.getPowInOut(5),dc.backIn=dc.getBackIn(1.7),dc.backOut=dc.getBackOut(1.7),dc.backInOut=dc.getBackInOut(1.7),dc.elasticIn=dc.getElasticIn(1,.3),dc.elasticOut=dc.getElasticOut(1,.3),dc.elasticInOut=dc.getElasticInOut(1,.3*1.5);class uc{constructor(){this.id=ya.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===So.END?this.removeAnimate(e):e.status===So.RUNNING||e.status===So.INITIAL?(this.animateCount++,e.advance(t)):e.status===So.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const pc=new uc;class gc{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class mc extends gc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let fc=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ya.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pc;this.id=t,this.timeline=e,this.status=So.INITIAL,this.tailAnimate=new vc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=It(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&Ao.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:xo.ANIMATE_PLAY})}runCb(t){const e=new mc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===So.RUNNING&&(this.status=So.PAUSED)}resume(){this.status===So.PAUSED&&(this.status=So.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new vc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===So.RUNNING&&(this.status=So.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=So.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};fc.mode=Ao.NORMAL,fc.interpolateMap=new Map;class vc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new _c(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?dc[i]:i,n=this._addStep(e,null,s);return n.type=ko.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?dc[i]:i,r=this._addStep(e,null,n);return r.type=ko.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=ko.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ko.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new _c(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return rt.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class _c{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const yc=200,bc="cubicOut",xc=1e3,Sc="quadInOut";var Ac;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Ac||(Ac={}));const kc=[!1,!1,!1,!1],Mc=[0,0,0,0],Tc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Mc[0]=t[0],Mc[2]=t[0],Mc[1]=t[1],Mc[3]=t[1],Mc):t:t:0,wc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Cc=[1,2,3,0,1,2,3,0];function Ec(t,e,i,s){for(;t>=Bt;)t-=Bt;for(;t<0;)t+=Bt;for(;t>e;)e+=Bt;wc[0].x=i,wc[1].y=i,wc[2].x=-i,wc[3].y=-i;const n=Math.ceil(t/Et)%4,r=Math.ceil(e/Et)%4;if(s.add(Ot(t)*i,Ft(t)*i),s.add(Ot(e)*i,Ft(e)*i),n!==r||e-t>Ct){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Oc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Oc.TimeOut=1e3/60;const Ic=new Oc,Dc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Fc extends gc{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ut(this.fromNumber),Ut(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var jc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(jc||(jc={}));class zc extends gc{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Xt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=Pc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Hc extends gc{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:xo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:xo.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:xo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vc extends Hc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=Ol.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Nc extends Hc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Ol.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Gc extends gc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class Wc extends gc{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?dc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Uc(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Yc(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{ut(e,s)&&ut(i,n)||t.push(e,i,s,n,s,n)};function Jc(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tm:if:i2&&i.push(s),i}function Qc(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function id(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),rd=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ad=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Zt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return rd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return rd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ad(n[0],s,i),ad(n[1],e-s,i)}};var od;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(od||(od={}));class ld{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:od.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===od.Color1){const e=ld.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ve.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];ld.store1[t]=e,ld.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=ld.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ve.parseColorString(t);return n&&(ld.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ld.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===od.Color1){if(ld.store1[t])return;ld.store1[t]=i,ld.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ld.store255[t])return;ld.store255[t]=i,ld.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function hd(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function cd(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>dd(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):dd(t,e,i,s,n)}function dd(t,e,i,s,n){if(!t||!e)return t&&hd(t)||e&&hd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ld.Get(t,od.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ld.Get(e,od.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:hd(a)})))});return o?cd(r,l,i,s,n):cd(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:gd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:gd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:gd(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),hd(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}ld.store255={},ld.store1={};const ud=[0,0,0,0],pd=[0,0,0,0];function gd(t,e,i){return ld.Get(t,od.Color255,ud),ld.Get(e,od.Color255,pd),`rgba(${Math.round(ud[0]+(pd[0]-ud[0])*i)},${Math.round(ud[1]+(pd[1]-ud[1])*i)},${Math.round(ud[2]+(pd[2]-ud[2])*i)},${ud[3]+(pd[3]-ud[3])*i})`}const md=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=cd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},fd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Jc(t):[],n=Jc(e);i&&s&&(i.fromTransform&&Qc(s,i.fromTransform.clone().getInverse()),Qc(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},_d=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],yd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!_d.includes(n))return;const r=e[n];u(r)||u(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?ld.Get(t[n],od.Color255):t[n],to:"string"==typeof r?ld.Get(r,od.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class bd extends gc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;fd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&md(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const xd=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=vd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=yd(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new bd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:xc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Sc)),c};class Sd extends gc{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;fd(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&md(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Ad=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Rc.includes(t))(i)||(e[i]=t[i])})),e},kd=(t,e,i)=>{const s=Ad(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Ol.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Md=(t,e,i)=>{const s=[],n=i?null:Ad(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Ad(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=ed(t.attribute),n=id(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ol.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=id(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(Ol.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=id(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(Ol.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return sd(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return sd(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ol.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:nd(i)}];const s=[];return ad(i,e,s),s})(t,e).forEach((t=>{s.push(Ol.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return ad(r,e,h),h})(t,e).forEach((t=>{s.push(Ol.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Jc(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(Ol.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ol.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&kd(t,s,e),s};class wd{static GetImage(t,e){var i;const s=wd.cache.get(t);s?"fail"===s.loadState?Ol.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):wd.loadImage(t,e)}static GetSvg(t,e){var i;let s=wd.cache.get(t);s?"fail"===s.loadState?Ol.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},wd.cache.set(t,s),s.dataPromise=Ol.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=wd.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},wd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ol.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ol.global.loadBlob(t):"json"===e&&(i.dataPromise=Ol.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!wd.isLoading&&wd.toLoadAueue.length){wd.isLoading=!0;const t=wd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(wd.cache.set(i,n),n.dataPromise=Ol.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{wd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),wd.loading()})).catch((t=>{console.error(t),wd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),wd.loading()}))}}),0)}static loadImage(t,e){const i=Cd(t,wd.toLoadAueue);if(-1!==i)return wd.toLoadAueue[i].marks.push(e),void wd.loading();wd.toLoadAueue.push({url:t,marks:[e]}),wd.loading()}static improveImageLoading(t){const e=Cd(t,wd.toLoadAueue);if(-1!==e){const t=wd.toLoadAueue.splice(e,1);wd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Cd(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Jt,this._updateTag=yo.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Id.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Id.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Id.x=n,Id.y=r;return Id}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Ol.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Ol.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ae),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&yo.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&yo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&yo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&yo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=yo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===bo.GLOBAL){const i=new Xt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Bd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Bd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Ol.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:yc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:bc),c&&this.setAttributes(c,!1,{type:xo.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:xo.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=yo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=yo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&yo.UPDATE_SHAPE_AND_BOUNDS)===yo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=yo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=yo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=yo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=yo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=yo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=yo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=yo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&yo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Pd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Pd),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,scaleX:i=ul.scaleX,scaleY:s=ul.scaleY,angle:n=ul.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ot(a),m=Ft(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,A=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-A*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Ol.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ul);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ed.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Ol.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:xo.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:xo.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=cd(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=cd(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=cd(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Kh(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ol.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new hl).fromString(t):this.pathProxy=new hl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Ol.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new tc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Fd.mixin(nc);class jd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function zd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Hd(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Vd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Nd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Hd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=zd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Hd(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new jd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new jd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function Gd(t,e){return Wd(t)}function Wd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let qd=0;function Zd(){return qd++}var Jd;function Qd(t){const e=[];let i=0,s="";for(let n=0;ntu.set(t,!0)));const eu=new Map;function iu(t){if(tu.has(t))return!0;if(eu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>eu.set(t,!0)));const su=Zd(),nu=Zd(),ru=Zd(),au=Zd(),ou=Zd(),lu=Zd(),hu=Zd(),cu=Zd(),du=Zd(),uu=Zd();Zd();const pu=Zd();Zd();const gu=Zd(),mu=Zd(),fu=Zd(),vu=Symbol.for("GraphicService"),_u=Symbol.for("GraphicCreator"),yu={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},bu=Object.keys(yu);var xu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(xu||(xu={}));let Su=class t extends Fd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=lu,this._childUpdateTag=yo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Uh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Uh)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===bo.GLOBAL){const i=new Xt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&yo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Ol.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Ol.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,dx:i=ul.dx,dy:s=ul.dy,scaleX:n=ul.scaleX,scaleY:r=ul.scaleY,angle:a=ul.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Kh(this).group;this._AABBBounds.clear();const i=Ol.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Tc(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=yo.CLEAR_BOUNDS,this._childUpdateTag&=yo.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&yo.UPDATE_BOUNDS||(this._childUpdateTag|=yo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Ol.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Ol.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Ol.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Ol.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Ol.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&yo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Ol.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Au(t){return new Su(t)}Su.NOWORK_ANIMATE_ATTR=Dd;class ku extends Su{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Uh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ol.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Ol.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Mu=Symbol.for("TransformUtil"),Tu=Symbol.for("GraphicUtil"),wu=Symbol.for("LayerService"),Cu=Symbol.for("StaticLayerHandlerContribution"),Eu=Symbol.for("DynamicLayerHandlerContribution"),Pu=Symbol.for("VirtualLayerHandlerContribution");var Bu,Ru=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ou=Bu=class{static GenerateLayerId(){return`${Bu.idprefix}_${Bu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ol.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?$l.get(Cu):"dynamic"===t?$l.get(Eu):$l.get(Pu),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new ku(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Bu.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Ou.idprefix="visactor_layer",Ou.prefix_count=0,Ou=Bu=Ru([La(),Lu("design:paramtypes",[])],Ou);var Iu=new ba((t=>{t(eo).to(ro).inSingletonScope(),t(Bh).to(Lh),t(Tu).to(Fh).inSingletonScope(),t(Mu).to(Hh).inSingletonScope(),t(wu).to(Ou).inSingletonScope()}));function Du(t,e){return!(!t&&!e)}function Fu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function ju(t,e,i){return i&&t*e>0}function zu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Hu(t,e){return t*e>0}function Vu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Nu(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Wu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Rt(l-o),c=l>o;let d=!1;if(n=Bt-wt)e.moveTo(i+n*Ot(o),s+n*Ft(o)),e.arc(i,s,n,o,l,!c),r>wt&&(e.moveTo(i+r*Ot(l),s+r*Ft(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:m,outerEndAngle:f,innerEndAngle:v,innerStartAngle:_}=t.getParsePadAngle(o,l),y=u,b=u,x=u,S=u,A=Math.max(b,y),k=Math.max(x,S);let M=A,T=k;const w=n*Ot(m),C=n*Ft(m),E=r*Ot(v),P=r*Ft(v);let B,R,L,O;if((k>wt||A>wt)&&(B=n*Ot(f),R=n*Ft(f),L=r*Ot(_),O=r*Ft(_),hwt){const t=Dt(y,M),r=Dt(b,M),o=Gu(L,O,w,C,n,t,Number(c)),l=Gu(B,R,E,P,n,r,Number(c));M0&&e.arc(i+o.cx,s+o.cy,t,Lt(o.y01,o.x01),Lt(o.y11,o.x11),!c),e.arc(i,s,n,Lt(o.cy+o.y11,o.cx+o.x11),Lt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Lt(l.y11,l.x11),Lt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ot(Lt(l.y01,l.x01)),s+l.cy+r*Ft(Lt(l.y01,l.x01))):e.moveTo(i+B,s+n*Ft(f))}else!a||a[0]?(e.moveTo(i+w,s+C),e.arc(i,s,n,m,f,!c)):e.moveTo(i+n*Ot(f),s+n*Ft(f));if(!(r>wt)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(T>wt){const t=Dt(S,T),n=Dt(x,T),o=Gu(E,P,B,R,r,-n,Number(c)),l=Gu(w,C,L,O,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Lt(o.y01,o.x01),Lt(o.y11,o.x11),!c),e.arc(i,s,r,Lt(o.cy+o.y11,o.cx+o.x11),Lt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Lt(l.y11,l.x11),Lt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ot(Lt(l.y01,l.x01)),s+l.cy+t*Ft(Lt(l.y01,l.x01))):e.moveTo(i+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,_,c):e.moveTo(i+r*Ot(_),s+r*Ft(_))}return a?a[3]&&e.lineTo(i+n*Ot(o),s+n*Ft(o)):e.closePath(),d}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=Ol.global.createCanvas({})),Uu.canvas}catch(t){return null}}static GetCtx(){if(!Uu.ctx){const t=Uu.GetCanvas();Uu.ctx=t.getContext("2d")}return Uu.ctx}}class Yu extends oe{static getInstance(){return Yu._instance||(Yu._instance=new Yu),Yu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Uu.GetCanvas(),s=Uu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Yu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Ku{static GetSize(t){for(let e=0;e=t)return Ku.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Ku.GenKey(t,e,i,s,n),l=Ku.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=Ku.GenKey(t,e,i,s,n);Ku.cache[l]?Ku.cache[l].push({width:a,height:o,pattern:r}):Ku.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Ku.cache={},Ku.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=Symbol.for("ArcRenderContribution"),$u=Symbol.for("AreaRenderContribution"),qu=Symbol.for("CircleRenderContribution"),Zu=Symbol.for("GroupRenderContribution"),Ju=Symbol.for("ImageRenderContribution"),Qu=Symbol.for("PathRenderContribution"),tp=Symbol.for("PolygonRenderContribution"),ep=Symbol.for("RectRenderContribution"),ip=Symbol.for("SymbolRenderContribution"),sp=Symbol.for("TextRenderContribution"),np=Symbol.for("InteractiveSubRenderContribution"),rp=["radius","startAngle","endAngle",...Bd];class ap extends Fd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=au}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Kh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=Ol.graphicService.updateCircleAABBBounds(i,Kh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,rp)}needUpdateTag(t){return super.needUpdateTag(t,rp)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new hl;return o.arc(0,0,n,r,a),o}clone(){return new ap(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ap.NOWORK_ANIMATE_ATTR}}function op(t){return new ap(t)}function lp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function hp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function cp(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}ap.NOWORK_ANIMATE_ATTR=Dd;class dp{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=fu,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Kh(this).text;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Kh(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Dc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=Ol.graphicUtil.textMeasure,k=new dp(a,{fontSize:h,fontWeight:m,fontFamily:a},A),M=y(t)?t.map((t=>t.toString())):[t.toString()],T=[],w=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===Jd.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=hp(x,o),M=cp(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Kh(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Dc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=Ol.graphicUtil.textMeasure,y=new dp(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Kh(this).text,a=Ol.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Dc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=It(e,o)}));const t=hp(x,o),e=this.cache.verticalList.length*b,i=cp(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>Qd(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Jd.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=It(e,o)}));const k=hp(x,o),M=this.cache.verticalList.length*b,T=cp(S,M,g);return this._AABBBounds.set(T,k,T+M,k+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:up;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:up;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function gp(t){return new pp(t)}pp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Dd),pp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},pp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class mp{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function fp(t,e,i,s,n){return n?t.arc(i,s,e,0,Pt,!1,n):t.arc(i,s,e,0,Pt),!1}var vp=new class extends mp{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return fp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return fp(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var _p=new class extends mp{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function yp(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var bp=new class extends mp{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return yp(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return yp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return yp(t,e/2+n,i,s,r)}};function xp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Sp=new class extends mp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return xp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return xp(t,e/2+n,i,s)}};class Ap extends mp{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var kp=new Ap;var Mp=new class extends Ap{constructor(){super(...arguments),this.type="triangle"}};const Tp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),wp=Math.sin(Pt/10)*Tp,Cp=-Math.cos(Pt/10)*Tp;function Ep(t,e,i,s){const n=wp*e,r=Cp*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Pt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Pp=new class extends mp{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Ep(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Ep(t,e/2+n,i,s)}};const Bp=jt(3);function Rp(t,e,i,s){const n=e,r=n/Bp,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Lp=new class extends mp{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Rp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Rp(t,e/2+n,i,s)}};function Op(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Ip=new class extends mp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Op(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Op(t,e/2+n,i,s)}};function Dp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Fp=new class extends mp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Dp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Dp(t,e/2+n,i,s)}};const jp=-.5,zp=jt(3)/2,Hp=1/jt(12);function Vp(t,e,i,s){const n=e/2,r=e*Hp,a=n,o=e*Hp+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(jp*n-zp*r+i,zp*n+jp*r+s),t.lineTo(jp*a-zp*o+i,zp*a+jp*o+s),t.lineTo(jp*l-zp*h+i,zp*l+jp*h+s),t.lineTo(jp*n+zp*r+i,jp*r-zp*n+s),t.lineTo(jp*a+zp*o+i,jp*o-zp*a+s),t.lineTo(jp*l+zp*h+i,jp*h-zp*l+s),t.closePath(),!1}var Np=new class extends mp{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Vp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Vp(t,e/2+n,i,s)}};var Gp=new class extends mp{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var Wp=new class extends mp{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var Up=new class extends mp{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const Yp=jt(3);function Kp(t,e,i,s){const n=e*Yp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Xp=new class extends Ap{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Kp(t,e/2/Yp,i,s)}drawOffset(t,e,i,s,n){return Kp(t,e/2/Yp+n,i,s)}};function $p(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var qp=new class extends mp{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return $p(t,e/4,i,s)}drawOffset(t,e,i,s,n){return $p(t,e/4+n,i,s)}};function Zp(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var Jp=new class extends mp{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Zp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Zp(t,e/4+n,i,s)}};function Qp(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var tg=new class extends mp{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Qp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Qp(t,e/4+n,i,s)}};function eg(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var ig=new class extends mp{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return eg(t,e/4,i,s)}drawOffset(t,e,i,s,n){return eg(t,e/4+n,i,s)}};function sg(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var ng=new class extends mp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return sg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return sg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function rg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var ag=new class extends mp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return rg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return rg(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function og(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var lg=new class extends mp{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return og(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return og(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function hg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function cg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var dg=new class extends mp{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?cg(t,e,i,s):hg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?cg(t,e+2*n,i,s):hg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const ug=new Jt;class pg{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ro(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(Ro(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;ug.x1=s.bounds.x1*t,ug.y1=s.bounds.y1*t,ug.x2=s.bounds.x2*t,ug.y2=s.bounds.y2*t,e.union(ug)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const gg={};[vp,_p,bp,Sp,Xp,Mp,Pp,Lp,Ip,Fp,Np,Gp,Wp,kp,Up,qp,Jp,tg,ig,dg,ng,ag,lg].forEach((t=>{gg[t.type]=t}));const mg={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},fg=new Jt,vg=["symbolType","size",...Bd];let _g=class t extends Fd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=mu}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Kh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=gg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=mg[i]||i,!0===((n=i).startsWith("{const e=(new hl).fromString(t.d),i={};bu.forEach((e=>{t[e]&&(i[yu[e]]=t[e])})),r.push({path:e,attribute:i}),fg.union(e.bounds)}));const a=fg.width(),o=fg.height(),l=1/It(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new pg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new hl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/It(a,o);return r.transform(0,0,l,l),this._parsedPath=new pg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Kh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=Ol.graphicService.updateSymbolAABBBounds(i,Kh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,vg)}needUpdateTag(t){return super.needUpdateTag(t,vg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new hl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yg(t){return new _g(t)}_g.userSymbolMap={},_g.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Dd);const bg=["segments","points","curveType",...Bd];let xg=class t extends Fd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=cu}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Bc(i,s,e))}doUpdateAABBBounds(){const t=Kh(this).line;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateLineAABBBounds(e,Kh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){const t=this.attribute,e=new hl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Dd);const Ag=["width","x1","y1","height","cornerRadius",...Bd];class kg extends Fd{constructor(t){super(t),this.type="rect",this.numberType=pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Kh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateRectAABBBounds(e,Kh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Ag)}needUpdateTag(t){return super.needUpdateTag(t,Ag)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=ed(t),r=new hl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}}function Mg(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Dd;class Tg extends Fd{constructor(t){super(t),this.type="glyph",this.numberType=ou,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=Ol.graphicService.updateGlyphAABBBounds(this.attribute,Kh(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Tg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Tg.NOWORK_ANIMATE_ATTR}}function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Dd;class Cg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Il[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Eg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Dc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Gl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Gl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Vl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Gl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||Fl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||Dl;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Vl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Gl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Pg=["width","height","image",...Bd];class Bg extends Fd{constructor(t){super(t),this.type="image",this.numberType=hu,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Kh(this).image;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateImageAABBBounds(e,Kh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Pg)}needUpdateTag(t){return super.needUpdateTag(t,Pg)}clone(){return new Bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Dd);class Lg extends Bg{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Tc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Tc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Rl.width,height:e=Rl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Og{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Lg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Il[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Eg){const e=Hl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof Lg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Gl(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof Lg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Lg)break;const{width:n}=Gl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof Lg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ig{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=Il[this.direction]}store(t){if(t instanceof Lg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Og(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof Lg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,s=Vl(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==s){const[e,i]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Eg(i,t.newLine,t.character),new Eg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Dg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Bd];class Fg extends Fd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=gu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Bl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Bl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Bl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Bl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Bl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Bl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Bl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Kh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateRichTextAABBBounds(e,Kh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Bl[t]}needUpdateTags(t){return super.needUpdateTags(t,Dg)}needUpdateTag(t){return super.needUpdateTag(t,Dg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:s,width:n,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,f="number"==typeof s&&Number.isFinite(s)&&s>0,v="number"==typeof n&&Number.isFinite(n)&&n>0&&(!m||n<=i),_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!f||r<=s),y=new Cg(0,0,(v?n:m?i:0)||0,(_?r:f?s:0)||0,a,o,l,h,c,d||"horizontal",!v&&m,!_&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Ig(y);if(p){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i,n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s)})),n}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Dd);const zg=["path","customPath",...Bd];class Hg extends Fd{constructor(t){super(t),this.type="path",this.numberType=du}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=Kh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hl?this.cache:t.path)}doUpdateAABBBounds(){const t=Kh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updatePathAABBBounds(e,Kh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new hl).fromString(t.path):t.customPath&&(this.cache=new hl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}toCustomPath(){return(new hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Hg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function Vg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Dd);const Ng=["segments","points","curveType",...Bd];class Gg extends Fd{constructor(t){super(t),this.type="area",this.numberType=ru}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Kh(this).area;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateAreaAABBBounds(e,Kh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Bc(i,s,e))}getDefaultAttribute(t){return Kh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}toCustomPath(){const t=new hl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Gg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gg.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Gg(t)}Gg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Dd);const Ug=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Bd];class Yg extends Fd{constructor(t){super(t),this.type="arc",this.numberType=su}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=Kh(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Kh(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=ee(e),i=e+r,s&&Rt(r)wt&&o>wt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=Kh(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=jt(a*a+o*o)}=this.attribute,h=Rt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>wt&&l>wt){const i=e>t?1:-1;let s=Vt(Number(l)/o*Ft(g)),n=Vt(Number(l)/a*Ft(g));return(m-=2*s)>wt?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>wt?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=Kh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=Ol.graphicService.updateArcAABBBounds(i,Kh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Ug)}needUpdateTag(t){return super.needUpdateTag(t,Ug)}getDefaultAttribute(t){return Kh(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Rt(i-e),a=i>e;if(n=Bt-wt)o.moveTo(0+n*Ot(e),0+n*Ft(e)),o.arc(0,0,n,e,i,!a),s>wt&&(o.moveTo(0+s*Ot(i),0+s*Ft(i)),o.arc(0,0,s,i,e,a));else{const t=n*Ot(e),r=n*Ft(e),l=s*Ot(i),h=s*Ft(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new Yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Dd);const Xg=["points","cornerRadius",...Bd];class $g extends Fd{constructor(t){super(t),this.type="polygon",this.numberType=uu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Kh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updatePolygonAABBBounds(e,Kh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Bc(i,s,e))}getDefaultAttribute(t){return Kh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}toCustomPath(){const t=this.attribute.points,e=new hl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new $g(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function qg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Dd;class Zg extends Su{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Jg(t){return new Zg(t)}class Qg{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class tm extends Qg{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;$d(i,s+(r+o)/2,!0,a)}return i}}class em{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return em.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},am=function(t,e){return function(i,s){e(i,s,t)}};function om(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function lm(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function hm(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function cm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),om(t,t,[n+o,r+l,a+h]),om(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),om(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=sm.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}om(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),om(i,i,[-s[0],-s[1],0]),hm(t,t,i)}}let dm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Qa(["graphic"]),onSetStage:new Qa(["graphic","stage"]),onRemove:new Qa(["graphic"]),onRelease:new Qa(["graphic"]),onAddIncremental:new Qa(["graphic","group","stage"]),onClearIncremental:new Qa(["graphic","group","stage"]),beforeUpdateAABBBounds:new Qa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Qa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Jt,this.tempAABBBounds2=new Jt,this._rectBoundsContribitions=[new Qg],this._symbolBoundsContribitions=[new tm],this._imageBoundsContribitions=[new Qg],this._circleBoundsContribitions=[new Qg],this._arcBoundsContribitions=[new Qg],this._pathBoundsContribitions=[new Qg]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new oo(t);return Ro(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=cp(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=hp(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){$d(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),qt(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Bt-wt?i.set(-a,-a,a,a):Ec(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=wt?i.set(0,0,0,0):Math.abs(l-h)>Bt-wt?i.set(-n,-n,n,n):(Ec(h,l,n,i),Ec(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(y(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){$d(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;$d(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&qt(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};dm=nm([La(),am(0,Ba(_u)),rm("design:paramtypes",[Object])],dm);const um=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let pm,gm;function mm(t){return pm||(pm=um.CreateGraphic("text",{})),pm.initAttributes(t),pm.AABBBounds}const fm={x:0,y:0,z:0,lastModelMatrix:null};class vm{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===wo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===wo.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=ju(o,l,n),p=Hu(o,c),g=Du(n,r),m=Fu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;fm.x=n,fm.y=r,fm.z=a,fm.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=sm.allocate(),n=sm.allocate();cm(n,t,e),hm(s,d||s,n),fm.x=0,fm.y=0,fm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),sm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);fm.x+=s.x,fm.y+=s.y,fm.z=a,i.setTransformForCurrent()}else if(p)fm.x=0,fm.y=0,fm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);fm.x+=s.x,fm.y+=s.y,this.transformWithoutTranslate(i,fm.x,fm.y,fm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),fm.x=0,fm.y=0,fm.z=0;return fm}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Kh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=ju(d,u,h),y=Hu(d,g),b=Du(h),x=Fu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Ro(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&sm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const _m=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class ym{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(ym.IsGradientStr(t))try{const e=_m(t)[0];if(e){if("linear"===e.type)return ym.ParseLinear(e);if("radial"===e.type)return ym.ParseRadial(e);if("conic"===e.type)return ym.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2,n=parseFloat(e.value)/180*Ct-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Bt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2;let n="angular"===e.type?parseFloat(e.value)/180*Ct:0;for(;n<0;)n+=Bt;for(;n>Bt;)n-=Bt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function bm(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function xm(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(y(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,m=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,m/=e,u/=t,p/=e}const f=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,m+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,m+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{f.addColorStop(t.offset,t.color)})),f}(t,a,i,s,n)),r||"orange")}var Sm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},km=function(t,e){return function(i,s){e(i,s,t)}};class Mm{constructor(){this.time=wo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Kh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Ch.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Ch.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Tm=new Mm;let wm=class{constructor(t){this.subRenderContribitions=t,this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};wm=Sm([La(),km(0,Ba($a)),km(0,Oa(np)),Am("design:paramtypes",[Object])],wm);class Cm{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Ch.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Ch.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Bt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Em=new Cm;const Pm=new class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,M-=f;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=bm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Wu(t,e,i,s,T+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=bm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Wu(t,e,i,s,T-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:T,innerRadius:M,startAngle:_,endAngle:y})}},Bm=Em,Rm=Tm;const Lm=new class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=bm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f+r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=bm(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,f-r,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},Om=Em,Im=Tm;const Dm=new class extends Mm{constructor(){super(...arguments),this.time=wo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Fm=Ct/2;function jm(t,e,i,s,n,r){let a;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))a=[r=Rt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:a=[0,0,0,0];break;case 1:e=Rt(t[0]),a=[e,e,e,e];break;case 2:case 3:e=Rt(t[0]),i=Rt(t[1]),a=[e,i,e,i];break;default:a=t,a[0]=Rt(a[0]),a[1]=Rt(a[1]),a[2]=Rt(a[2]),a[3]=Rt(a[3])}}else a=[0,0,0,0];if(s<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,s,n);const[o,l,h,c]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],d=Math.min(s/2,n/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],m=[l[0]-u[1],l[1]],f=[l[0],l[1]+u[1]],v=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],y=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(m[0],m[1]),!q(m,f)){const e=m[0],i=m[1]+u[1];t.arc(e,i,u[1],-Fm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,Fm,!1)}if(t.lineTo(y[0],y[1]),!q(y,b)){const e=y[0],i=y[1]-u[3];t.arc(e,i,u[3],Fm,Ct,!1)}if(t.lineTo(g[0],g[1]),!q(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],Ct,Ct+Fm,!1)}return t.closePath(),t}var zm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Hm{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:A-i)||0,T=(null!=T?T:k-s)||0;const w=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=bm(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M+h,T+h)):(e.beginPath(),jm(e,a,o,M+h,T+h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=p,r=bm(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(a,o,M-h,T-h)):(e.beginPath(),jm(e,a,o,M-h,T-h,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let Vm=class{constructor(){this.time=wo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};Vm=zm([La()],Vm);let Nm=class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke}=t.attribute;let{width:v,height:_}=t.attribute;if(v=(null!=v?v:u-g)||0,_=(null!=_?_:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+v,s):e.moveTo(i+v,s),f[1]?e.lineTo(i+v,s+_):e.moveTo(i+v,s+_),f[2]?e.lineTo(i,s+_):e.moveTo(i,s+_),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Nm=zm([La()],Nm);const Gm=new Hm,Wm=Em,Um=Tm;const Ym=new class extends Hm{constructor(){super(...arguments),this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},Km=new class extends Mm{constructor(){super(...arguments),this.time=wo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Kh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Tc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?jm(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Xm=new class{constructor(){this.time=wo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(m){const{distance:n=l.outerBorder.distance}=p,r=bm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,p,(y-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=g,r=bm(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,g,(y-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},$m=Em,qm=Tm;var Zm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qm=function(t,e){return function(i,s){e(i,s,t)}};let tf=class extends vm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=su,this.builtinContributions=[Pm,Rm,Bm],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Rt(d-c),p=d>c;let g=!1;if(nwt||T>wt)&&(O=n*Ot(y),I=n*Ft(y),D=r*Ot(x),F=r*Ft(x),uwt){const t=Dt(S,C),r=Dt(A,C),a=Gu(D,F,P,B,n,t,Number(p)),o=Gu(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Lt(o.y11,o.x11),Lt(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>wt)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>wt){const t=Dt(M,E),n=Dt(k,E),a=Gu(R,L,O,I,r,-n,Number(p)),o=Gu(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&e.arc(i+a.cx,s+a.cy,n,Lt(a.y01,a.x01),Lt(a.y11,a.x11),!p);const t=Lt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*Ot(x),s+r*Ft(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Kh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g,{outerPadding:y=l.outerPadding,innerPadding:b=l.innerPadding,cap:x=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;A+=y,k-=b;let M=0;const T=(c(x)&&x||x[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Rt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)kc[s]=t,i&&(i=!(null!==(e=kc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)kc[e]=!!t[e],i&&(i=!!kc[e]);else kc[0]=!1,kc[1]=!1,kc[2]=!1,kc[3]=!1;return{isFullStroke:i,stroke:kc}})(d);if((v||C)&&(e.beginPath(),Wu(t,e,i,s,A,k),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&C&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))),!C&&_&&(e.beginPath(),Wu(t,e,i,s,A,k,E),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(x)&&x||x[1])&&S){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Rt(h-r)>=Bt-wt){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,A,k,d,d+r),w||this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Bt;for(;i>Bt;)i-=Bt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),cd(o.color,l.color,h,!1)}(0,0,h,n);a||ju&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}_&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),T&&(h.startAngle+=M,h.endAngle+=M)}draw(t,e,i,s){const n=Kh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};tf=Zm([La(),Qm(0,Ba($a)),Qm(0,Oa(Xu)),Jm("design:paramtypes",[Object])],tf);var ef=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nf=function(t,e){return function(i,s){e(i,s,t)}};let rf=class extends vm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=au,this.builtinContributions=[Lm,Im,Om],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Kh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Kh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function af(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Fo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function of(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),af(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let m;"x"===s?m=Mo.ROW:"y"===s?m=Mo.COLUMN:"auto"===s&&(m=e.direction);const f=i*e.tryUpdateLength(m);let v=0,_=!0,y=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hf=class extends vm{constructor(){super(...arguments),this.numberType=cu}draw(t,e,i,s){const n=Kh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;of(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:M,connectedY:T,connectedStyle:w}=a;if(y(o)?(k=null!==(f=null!=k?k:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(_=null!=T?T:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,w=null!==(b=null!=w?w:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,M=null!=M?M:o.connectedX,T=null!=T?T:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),of(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:M,zeroY:T});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,S-c,A-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,S-c,A-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===f)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ll(t.points,f,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===f){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Dt(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,_,i,s,t,a,o)}};function cf(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function df(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),af(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),af(t,l,1,s),o=!1):o=!0}t.closePath()}hf=lf([La()],hf);const uf=new class extends Cm{constructor(){super(...arguments),this.time=wo.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Lc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Lc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Lc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Lc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},pf=Tm;var gf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ff=function(t,e){return function(i,s){e(i,s,t)}};function vf(t,e,i){switch(e){case"linear":default:return Yo(t,i);case"basis":return $o(t,i);case"monotoneX":return il(t,i);case"monotoneY":return sl(t,i);case"step":return rl(t,.5,i);case"stepBefore":return rl(t,0,i);case"stepAfter":return rl(t,1,i);case"linearClosed":return ol(t,i)}}let _f=class extends vm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=ru,this.builtinContributions=[uf,pf],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f,v;const{points:_}=t.attribute;if(_.length<2)return;e.beginPath();const b=null!==(p=this.z)&&void 0!==p?p:0,x=_[0];e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}for(let t=_.length-1;t>=0;t--){const i=_[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,b)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:S=0,x:A=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,S-a,A-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(y(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(x.x+a,x.y+o,b);for(let t=1;t<_.length;t++){const i=_[t];e.lineTo(i.x+a,i.y+o,b)}}else if(i[2]){const t=_[_.length-1];e.moveTo(t.x+a,t.y+o,b);for(let t=_.length-2;t>=0;t--){const i=_[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,b)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,S-a,A-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Kh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:T}=t.attribute;let{curveType:w=g.curveType}=t.attribute;if(k&&"linear"===w&&(w="linearClosed"),1===A&&!T&&!M.some((t=>!1===t.defined))&&"linear"===w)return this.drawLinearAreaHighPerformance(t,e,!!m,S,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=vf(t.points,w,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=vf(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=vf(e,w),n=vf(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w);t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,x,v,S,y,r[u],[g,t.attribute],Dt(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Kh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:M}=a;const T=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(_=null!=A?A:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:w,segments:C}=u.attribute;let E,P,B=Mo.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=w[0],E=w[w.length-1];const R=Rt(E.x-P.x),L=Rt(E.y-P.y);B=Number.isFinite(R+L)?R>L?Mo.ROW:Mo.COLUMN:Mo.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),cf(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),cf(t,e,i,s),e.length=0,i.length=0)}n=o})),cf(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?Mo.ROW:Mo.COLUMN,Number.isFinite(u)||(h=Mo.COLUMN),Number.isFinite(p)||(h=Mo.ROW);const g=i*(h===Mo.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Af=function(t,e){return function(i,s){e(i,s,t)}};let kf=class extends vm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=du,this.builtinContributions=[bf,yf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Kh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;if(e.beginPath(),t.pathShape)Ro(t.pathShape.commandList,e,i,s,1,1,g);else{Ro((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,y,f,v,d,n,a,o),y&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),_&&(a?a(e,t.attribute,d):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,_,y,f,v,d,n,a,o)}draw(t,e,i,s){const n=Kh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};kf=xf([La(),Af(0,Ba($a)),Af(0,Oa(Qu)),Sf("design:paramtypes",[Object])],kf);var Mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wf=function(t,e){return function(i,s){e(i,s,t)}};let Cf=class extends vm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=pu,this.builtinContributions=[Gm,Um,Wm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Kh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:b-S)||0,M=(null!=M?M:x-A)||0;const T=zu(g,m,k,M,c),w=Vu(g,v,k,M),C=Du(c,d),E=Fu(u,f);if(!t.valid||!_)return;if(!C&&!E)return;if(!(T||w||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,M)):(e.beginPath(),jm(e,i,s,k,M,p));const P={doFill:C,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,C,E,T,w,h,n,a,o,P),P.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill())),P.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,C,E,T,w,h,n,a,o)}draw(t,e,i,s){const n=Kh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cf=Mf([La(),wf(0,Ba($a)),wf(0,Oa(ep)),Tf("design:paramtypes",[Object])],Cf);var Ef=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bf=function(t,e){return function(i,s){e(i,s,t)}};let Rf=class extends vm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=mu,this.builtinContributions=[Xm,qm,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Kh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m,x=t.getParsedPath();if(!x)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),S&&e.camera&&e.project){const n=e.project(i,s,A),r=e.camera;e.camera=null,!1===x.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===x.draw(e,c,i,s,A,((n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,_,b,f,v,h,n,a,o),_&&!x.isSvg&&(a?a(e,t.attribute,h):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),b&&!x.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,_,b,f,v,h,n,a,o)}draw(t,e,i,s){const n=Kh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Rf=Ef([La(),Bf(0,Ba($a)),Bf(0,Oa(ip)),Pf("design:paramtypes",[Object])],Rf);const Lf=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Jt)}allocate(t,e,i,s){if(!this.pools.length)return(new Jt).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Jt(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const Of=new class extends Mm{constructor(){super(...arguments),this.time=wo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let M,{background:T}=t.attribute;if(!T)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(m=T.y)&&void 0!==m?m:e.y1)+(null!==(f=T.dy)&&void 0!==f?f:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(C=Lf.allocate(i,s,i+n,s+r),T=T.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=T.x)&&void 0!==y?y:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=mm(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(jm(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&Lf.free(C),w()}};var If=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Df=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ff=function(t,e){return function(i,s){e(i,s,t)}};let jf=class extends vm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Of],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Kh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,whiteSpace:v=d.whiteSpace,fontSize:_=d.fontSize,verticalMode:y=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!y&&"vertical"===f){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Dc(t.attribute.lineHeight,_))&&void 0!==c?c:_,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:T,sVisible:w,doFill:C,doStroke:E}=M,P=!m,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,T,w,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=_;const t=im.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),im.free(t)}E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):T&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=_,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*_,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=It(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==_&&("top"===A?s=(k-_)/2:"middle"===A||"bottom"===A&&(s=-(k-_)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,T,w,d,n,a,o)}draw(t,e,i,s){const n=Kh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:m=a.fillOpacity}=i.attribute,f=i.clipedWidth,v=hp(l,f),_=cp(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:m};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+_+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+f,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,s,n,a),o.beginPath();const t=n+_+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+f,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,m=cp("alphabetic",h,h),f={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){f.lineWidth=t,l.setStrokeStyle(i,f,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+m+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){f.lineWidth=e,l.setStrokeStyle(i,f,s,n,o),l.beginPath();const t=n+m+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function zf(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yf=function(t,e){return function(i,s){e(i,s,t)}};let Kf=class extends vm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=uu,this.builtinContributions=[Gf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Kh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:m,sVisible:f,doFill:v,doStroke:_}=g;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?zf(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void zf(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=Hf(d,u),b=Hf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Vf(h,_,y,d,u),A=Vf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Hf(k,M),w=Vf(h,Hf(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,_,m,f,l,n,a,o),v&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),_&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,_,m,f,l,n,a,o)}draw(t,e,i,s){const n=Kh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Kf=Wf([La(),Yf(0,Ba($a)),Yf(0,Oa(tp)),Uf("design:paramtypes",[Object])],Kf);var Xf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qf=function(t,e){return function(i,s){e(i,s,t)}};const Zf=["","repeat-x","repeat-y","repeat"];let Jf=class extends vm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=hu,this.builtinContributions=[Ym,Km],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Kh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,image:f}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),x)if(a)a(e,t.attribute,l);else if(_){if(!f||!t.resources)return;const n=t.resources.get(f);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),jm(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Zf[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,x,!1,_,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void wd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Kh(t).image;this._draw(t,a,!1,i)}};Jf=Xf([La(),qf(0,Ba($a)),qf(0,Oa(Ju)),$f("design:paramtypes",[Object])],Jf);const Qf=Symbol.for("IncrementalDrawContribution"),tv=Symbol.for("ArcRender"),ev=Symbol.for("AreaRender"),iv=Symbol.for("CircleRender"),sv=Symbol.for("GraphicRender"),nv=Symbol.for("GroupRender"),rv=Symbol.for("LineRender"),av=Symbol.for("PathRender"),ov=Symbol.for("PolygonRender"),lv=Symbol.for("RectRender"),hv=Symbol.for("SymbolRender"),cv=Symbol.for("TextRender"),dv=Symbol.for("RichTextRender"),uv=Symbol.for("GlyphRender"),pv=Symbol.for("ImageRender"),gv=Symbol.for("DrawContribution");var mv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const vv=Symbol.for("DrawItemInterceptor"),_v=new Jt,yv=new Jt;class bv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){_v.copy(s.dirtyBounds),yv.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(_v),s.backupDirtyBounds.copy(yv)),!0}}class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let Sv=class{constructor(){this.order=1,this.interceptors=[new bv,new kv,new Av,new xv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===nu,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Bt;for(;o<0;)o+=Bt;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&sm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Mv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wv=function(t,e){return function(i,s){e(i,s,t)}};const Cv=Symbol.for("RenderService");let Ev=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Ev=Mv([La(),wv(0,Ba(gv)),Tv("design:paramtypes",[Object])],Ev);var Pv=new ba((t=>{t(Cv).to(Ev)}));const Bv=Symbol.for("PickerService"),Rv=Symbol.for("GlobalPickerService");var Lv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Ov=Symbol.for("PickItemInterceptor");let Iv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=im.allocateByObj(r),h=new Xt(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};Iv=Lv([La()],Iv);let Dv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Xt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Dv=Lv([La()],Dv);let Fv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===nu,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Bt;for(;o<0;)o+=Bt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Fv=Lv([La()],Fv);var jv=new ba(((t,e,i)=>{i(Bv)||(t(Rv).toSelf(),t(Bv).toService(Rv)),t(Fv).toSelf().inSingletonScope(),t(Ov).toService(Fv),t(Iv).toSelf().inSingletonScope(),t(Ov).toService(Iv),t(Dv).toSelf().inSingletonScope(),t(Ov).toService(Dv),Za(t,Ov)})),zv=new ba((t=>{t(vu).to(dm).inSingletonScope(),t(_u).toConstantValue(um)}));const Hv=Symbol.for("AutoEnablePlugins"),Vv=Symbol.for("PluginService");var Nv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wv=function(t,e){return function(i,s){e(i,s,t)}};let Uv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&$l.isBound(Hv)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Uv=Nv([La(),Wv(0,Ba($a)),Wv(0,Oa(Hv)),Gv("design:paramtypes",[Object])],Uv);var Yv=new ba((t=>{t(Vv).to(Uv),function(t,e){t($a).toDynamicValue((t=>{let{container:i}=t;return new qa(e,i)})).whenTargetNamed(e)}(t,Hv)})),Kv=new ba((t=>{Za(t,to)})),Xv=new ba((t=>{t(Kl).to(Xl).inSingletonScope(),Za(t,Kl)})),$v=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Ol.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Jl({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Zv=$v([La(),qv("design:paramtypes",[])],Zv);var Jv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let t_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Ol.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};t_=Jv([La(),Qv("design:paramtypes",[])],t_);var e_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},i_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let s_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Ol.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Jl({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};s_=e_([La(),i_("design:paramtypes",[])],s_);var n_=new ba((t=>{t(Zv).toSelf(),t(s_).toSelf(),t(t_).toSelf(),t(Cu).toService(Zv),t(Eu).toService(s_),t(Pu).toService(t_)}));var r_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function a_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return r_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function l_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var h_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},c_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},d_=function(t,e){return function(i,s){e(i,s,t)}};let u_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Zt,this.backupDirtyBounds=new Zt,this.global=Ol.global,this.layerService=Ol.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Re(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,im.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=l_(e,i,yl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Oe(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=Lf.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=im.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):a_(t,yl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Lf.free(n),im.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||$l.get(Qf);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},g_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},m_=function(t,e){return function(i,s){e(i,s,t)}};let f_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=lu}drawShape(t,e,i,s,n,r,a,o){const l=Kh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,A=zu(u,f,p,g,h),k=Vu(u,v,p,g),M=Du(h,c),T=Fu(d,x);if(!t.valid||!S)return;if(!m){if(!M&&!T)return;if(!(A||k||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),jm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Dm));const w={doFill:M,doStroke:T};this._groupRenderContribitions.forEach((r=>{r.time===wo.beforeFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o,w)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):A&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):k&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===wo.afterFillStroke&&r.drawShape(t,e,i,s,M,T,A,k,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave(),n.baseGlobalAlpha*=a;const o=Kh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=sm.allocate(),i=sm.allocate();cm(i,t,o),hm(e,l||e,i),n.modelMatrix=e,sm.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;let d;(h||c)&&n.translate(h,c),s&&s.drawingCb&&(d=s.drawingCb()),n.modelMatrix!==l&&sm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};f_=p_([La(),m_(0,Ba($a)),m_(0,Oa(Zu)),g_("design:paramtypes",[Object])],f_);var v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let __=class extends hf{constructor(){super(...arguments),this.numberType=cu}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Kh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=ju(u,p,c),_=Hu(u,g),y=Du(c),b=Fu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};__=v_([La()],__);var y_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let b_=class extends _f{constructor(){super(...arguments),this.numberType=ru}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Kh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=ju(u,d,c),m=Du(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};b_=y_([La()],b_);var x_,S_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},A_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},k_=function(t,e){return function(i,s){e(i,s,t)}},M_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(x_||(x_={}));let T_=class extends u_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=x_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Qa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return M_(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return M_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return M_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>M_(this,void 0,void 0,(function*(){if(2!==t.count)yield o_(t,yl.zIndex,((i,s)=>{if(this.status===x_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return M_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return M_(this,void 0,void 0,(function*(){this.rendering&&(this.status=x_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=x_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return M_(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>M_(this,void 0,void 0,(function*(){yield o_(t,yl.zIndex,(t=>M_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};T_=S_([La(),k_(0,Ra(sv)),k_(1,Ba(__)),k_(2,Ba(b_)),k_(3,Ba($a)),k_(3,Oa(vv)),A_("design:paramtypes",[Array,Object,Object,Object])],T_);var w_=new ba((t=>{t(Mm).toSelf().inSingletonScope(),t(Cm).toSelf().inSingletonScope(),t(gv).to(u_),t(Qf).to(T_),t(nv).to(f_).inSingletonScope(),t(sv).toService(nv),Za(t,Zu),t(wm).toSelf().inSingletonScope(),Za(t,np),Za(t,sv),t(Sv).toSelf().inSingletonScope(),t(vv).toService(Sv),Za(t,vv)}));function C_(){C_.__loaded||(C_.__loaded=!0,$l.load(Iu),$l.load(zv),$l.load(Pv),$l.load(jv),$l.load(Yv),function(t){t.load(Kv),t.load(Xv),t.load(n_)}($l),function(t){t.load(w_)}($l))}C_.__loaded=!1,C_();const E_=$l.get(eo);Ol.global=E_;const P_=$l.get(Tu);Ol.graphicUtil=P_;const B_=$l.get(Mu);Ol.transformUtil=B_;const R_=$l.get(vu);Ol.graphicService=R_;const L_=$l.get(wu);Ol.layerService=L_;class O_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ol.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Ol.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Ol.graphicService.hooks.onAttributeUpdate.taps=Ol.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onSetStage.taps=Ol.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class I_{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class D_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ol.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Ol.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Ol.graphicService.hooks.onAddIncremental.taps=Ol.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onClearIncremental.taps=Ol.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ol.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class F_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onRemove.unTap(this.key),Ol.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Ol.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ol.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[si(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=si(i);u(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&_(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Kh(t).text)}getTransformOfText(t){const e=Kh(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(u(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=Qe(h,c);o=t.x,l=t.y}const p=Ol.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=o+m.left-p.left,v=l+m.top-p.top;if(a.left=`${f}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:v,left:f,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else g(n.style)?a=Object.assign(Object.assign({},a),n.style):_(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));Ol.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===Ol.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&Ol.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Ol.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const j_=new Jt;class z_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Ol.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(j_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(j_,t.parent&&t.parent.globalTransMatrix)))})),Ol.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Ol.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Ol.graphicService.hooks.beforeUpdateAABBBounds.taps=Ol.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.afterUpdateAABBBounds.taps=Ol.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onRemove.taps=Ol.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const H_=new Jt;class V_{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=ya.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Jt}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Kh(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},m=g.main,f=g.cross;"column"!==r&&"column-reverse"!==r||(m.len=d,f.len=c,m.field="y",f.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,_=0;const y=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),s="x"===f.field?e.width():e.height();y.push({mainLen:i,crossLen:s}),v+=i,_=Math.max(_,s)}));const b=[];if(v>m.len&&"wrap"===a){let t=0,e=0;y.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>m.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:y.length-1,mainLen:t,crossLen:e})}else b.push({idx:y.length-1,mainLen:v,crossLen:_});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,m,y,x,t),x=t.idx+1})),_=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":f.len,center:f.len/2};this.layoutCross(p,o,f,t,y,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(f.len-_)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",f,s,y,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(f.len-_)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(f.len-_)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",f,n,y,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,Ol.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Ol.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&H_.copy(s)})),Ol.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(H_.equals(i)||this.tryLayout(t,!1))})),Ol.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Ol.graphicService.hooks.onAttributeUpdate.taps=Ol.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.beforeUpdateAABBBounds.taps=Ol.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.afterUpdateAABBBounds.taps=Ol.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onSetStage.taps=Ol.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const N_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===cc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=cc.INITIAL,Ol.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Ol.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:hc},{mode:"timeout",cons:lc},{mode:"manual",cons:oc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==cc.INITIAL&&(this.status=cc.PAUSE,!0)}resume(){return this.status!==cc.INITIAL&&(this.status=cc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===cc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===cc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=cc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=cc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};N_.addTimeline(pc),N_.setFPS(60);class G_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=ld.Get(e,od.Color1),this.ambient=i;const s=jt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Dt(It((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=_(e)?ld.Get(e,od.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function W_(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function U_(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Y_{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=sm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=sm.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],m=e[1],f=e[2],v=s[0],_=s[1],y=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})),i&&Ol.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!(r&&n&&n.createRoot))return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const q_="white";class Z_ extends Su{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:q_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new Uh,this.hooks={beforeRender:new Qa(["stage"]),afterRender:new Qa(["stage"])},this.global=Ol.global,!this.global.env&&X_()&&this.global.setEnv("browser"),this.window=$l.get(Bh),this.renderService=$l.get(Cv),this.pluginService=$l.get(Vv),this.layerService=$l.get(wu),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:q_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||N_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new uc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ac(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1),this.light=new G_(m,f,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Y_(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new I_))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new O_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new D_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Zt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new z_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new V_))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new F_))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new $_))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){this.pickerService||(this.pickerService=$l.get(Bv));const i=this.pickerService.pick(this.children,new Xt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;const e=$l.get(Bh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ty=new ae(1,0,0,1,0,0),ey={x:0,y:0};let iy=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this.path=new hl,this._clearMatrix=new ae(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return im.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(im.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(im.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ey),function(t,e,i){return wh(t,0,!1,e,i)}(this.path.commandList,ey.x,ey.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ey);const i=bm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return wh(t,e,!0,i,s)}(this.path.commandList,i,ey.x,ey.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(ty,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>im.free(t))),this.stack.length=0}};iy=J_([La(),Q_("design:paramtypes",[Object,Number])],iy);var sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ry={WIDTH:500,HEIGHT:500,DPR:1};let ay=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=ry.WIDTH,height:n=ry.HEIGHT,dpr:r=ry.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};ay.env="browser",ay=sy([La(),ny("design:paramtypes",[Object])],ay);var oy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ly=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Jt}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};ly=oy([La()],ly);var hy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dy=class{constructor(){this._uid=ya.GenAutoIncrementId(),this.viewBox=new Jt,this.modelMatrix=new ae(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};dy=hy([La(),cy("design:paramtypes",[])],dy);var uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},py=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gy=function(t,e){return function(i,s){e(i,s,t)}};let my=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Ol.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Jt).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ae(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=sm.allocate();if(lm(i,e),a){if(i){const t=sm.allocate();r.modelMatrix=hm(t,a,i),sm.free(i)}}else lm(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Xt(e.x,e.y),a=Kh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Xt(e.x,e.y);l.transformPoint(a,a);const o=Kh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&sm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),im.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function fy(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,m,f;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&fy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&fy(t,a,i,s,n))}function vy(t,e){const i=t.length-1,s=[t[0]];return fy(t,0,i,e,s),s.push(t[i]),s}my=uy([La(),gy(0,Ba($a)),gy(0,Oa(Ov)),py("design:paramtypes",[Object])],my);let _y=!1;const yy=new ba((t=>{_y||(_y=!0,t(tf).toSelf().inSingletonScope(),t(tv).to(tf).inSingletonScope(),t(sv).toService(tv),t(Xu).toService(wm),Za(t,Xu))}));let by=!1;const xy=new ba((t=>{by||(by=!0,t(Cf).toSelf().inSingletonScope(),t(lv).to(Cf).inSingletonScope(),t(sv).toService(lv),t(Nm).toSelf(),t(Vm).toSelf(),t(ep).toService(Nm),t(ep).toService(Vm),t(ep).toService(wm),Za(t,ep))}));let Sy=!1;const Ay=new ba((t=>{Sy||(Sy=!0,t(hf).toSelf().inSingletonScope(),t(__).toSelf().inSingletonScope(),t(rv).to(hf).inSingletonScope(),t(sv).toService(rv))}));let ky=!1;const My=new ba((t=>{ky||(ky=!0,t(_f).toSelf().inSingletonScope(),t(ev).to(_f).inSingletonScope(),t(sv).toService(ev),t($u).toService(wm),Za(t,$u),t(b_).toSelf().inSingletonScope())}));let Ty=!1;const wy=new ba((t=>{Ty||(Ty=!0,t(Rf).toSelf().inSingletonScope(),t(hv).to(Rf).inSingletonScope(),t(sv).toService(hv),t(ip).toService(wm),Za(t,ip))}));let Cy=!1;const Ey=new ba((t=>{Cy||(Cy=!0,t(rf).toSelf().inSingletonScope(),t(iv).to(rf).inSingletonScope(),t(sv).toService(iv),t(qu).toService(wm),Za(t,qu))}));let Py=!1;const By=new ba((t=>{Py||(Py=!0,t(cv).to(jf).inSingletonScope(),t(sv).toService(cv),t(sp).toService(wm),Za(t,sp))}));let Ry=!1;const Ly=new ba((t=>{Ry||(Ry=!0,t(kf).toSelf().inSingletonScope(),t(av).to(kf).inSingletonScope(),t(sv).toService(av),t(Qu).toService(wm),Za(t,Qu))}));let Oy=!1;const Iy=new ba((t=>{Oy||(Oy=!0,t(ov).to(Kf).inSingletonScope(),t(sv).toService(ov),t(tp).toService(wm),Za(t,tp))}));var Dy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fy=class{constructor(){this.numberType=ou}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Kh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Fy=Dy([La()],Fy);let jy=!1;const zy=new ba((t=>{jy||(jy=!0,t(uv).to(Fy).inSingletonScope(),t(sv).toService(uv))}));var Hy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ny=class extends vm{constructor(){super(),this.numberType=gu,this.builtinContributions=[Of],this.init()}drawShape(t,e,i,s,n){const r=Kh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=ju(o,l,!0),d=ju(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Kh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),jm(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Kh(t).richtext;this._draw(t,s,!1,i)}};Ny=Hy([La(),Vy("design:paramtypes",[])],Ny);let Gy=!1;const Wy=new ba((t=>{Gy||(Gy=!0,t(dv).to(Ny).inSingletonScope(),t(sv).toService(dv))}));let Uy=!1;const Yy=new ba((t=>{Uy||(Uy=!0,t(pv).to(Jf).inSingletonScope(),t(sv).toService(pv),t(Ju).toService(wm),Za(t,Ju))}));const Ky=(t,e)=>(d($y.warnHandler)&&$y.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Xy=(t,e,i)=>{if(!d($y.errorHandler))throw new Error(t);$y.errorHandler.call(null,t,e)},$y={silent:!1,warnHandler:!1,errorHandler:!1},qy=X_(),Zy=qy&&globalThis?globalThis.document:void 0;function Jy(t){return("desktop-browser"===t||"mobile-browser"===t)&&qy}function Qy(t){return tb(t)||"mobile-browser"===t}function tb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let eb=0;function ib(){return eb>=9999999&&(eb=0),eb++}function sb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function nb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const rb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),ab=t=>e=>R(e,t),ob=t=>{rt.getInstance().error(t)},lb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||ob("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&ob("Access path missing closing bracket: "+t),a&&ob("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return rb((i&&i.get||ab)(s),[n],e||n)},hb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>lb(t,e,i)));return t=>s.map((e=>e(t)))}return lb(t,e,i)};hb("id");const cb=rb((function(t){return t}),[],"identity"),db=rb((function(){return 0}),[],"zero");rb((function(){return 1}),[],"one"),rb((function(){return!0}),[],"true"),rb((function(){return!1}),[],"false"),rb((function(){return{}}),[],"emptyObject");const ub=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(u(e)||u(i))return u(e)&&u(i);if(!m(e)&&!m(i))return e===i;const n=y(e)?e:e[t],r=y(i)?i:i[t];return n===r||!1!==s&&(y(r)?!(!y(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!g(r)&&!(!g(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>pb(t,r,n)))))},gb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function mb(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function fb(t,e,i,s,n){let r=0,a=0;return mb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function vb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;mb(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:fb(t,e,i,n,h)}}function _b(t){return"horizontal"===t}function yb(t){return"vertical"===t}const bb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class xb extends Su{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,bb.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>bb.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const $b=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},qb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class Zb extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=ec.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ec.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||$b(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=qb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ec.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=qb(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=$b(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=ec.now()-i>this.config.press.time&&qb(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const tx=[0,0,0];let ex=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},pl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this._clearMatrix=new ae(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ae(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return im.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(im.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(im.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Bt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Ku.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(U_(tx,[t,e,i],this.modelMatrix),t=tx[0],e=tx[1],i=tx[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(U_(tx,[t,e,i],this.modelMatrix),t=tx[0],e=tx[1],i=tx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(U_(tx,[e,i,s],this.modelMatrix),e=tx[0],i=tx[1],s=tx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ol.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ol.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:fl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(U_(tx,[e,i,s],this.modelMatrix),e=tx[0],i=tx[1],s=tx[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o*this.baseGlobalAlpha,r.fillStyle=xm(this,l,t,i,s)):r.globalAlpha=a*o*this.baseGlobalAlpha}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=bm(this,l,this.dpr),r.strokeStyle=xm(this,h,t,i,s),r.lineJoin=c,d&&r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=lp(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=lp(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>im.free(t))),this.stack.length=0}};ex.env="browser",ex=Jb([La(),Qb("design:paramtypes",[Object,Number])],ex);var ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let nx=class extends ay{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ol.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ex(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function rx(t,e){return new ba((i=>{i(ql).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Zl).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}nx.env="browser",nx=ix([La(),sx("design:paramtypes",[Object])],nx);const ax=rx(nx,ex);var ox=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hx=function(t,e){return function(i,s){e(i,s,t)}};let cx=class extends my{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Ch.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ux=class{constructor(){this.type="group",this.numberType=lu}contains(t,e,i){return!1}};ux=dx([La()],ux);const px=new ba(((t,e,i,s)=>{px.__vloaded||(px.__vloaded=!0,t(Yb).to(ux).inSingletonScope(),t(Kb).toService(Yb),Za(t,Kb))}));px.__vloaded=!1;var gx=px;const mx=new ba(((t,e,i,s)=>{i(cx)||t(cx).toSelf().inSingletonScope(),i(Bv)?s(Bv).toService(cx):t(Bv).toService(cx)}));var fx,vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let yx=fx=class extends dy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${fx.idprefix}_${fx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ol.global,this.viewBox=new Jt,this.modelMatrix=new ae(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:fx.GenerateCanvasId(),canvasControled:!0};this.canvas=new nx(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new nx({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};yx.env="browser",yx.idprefix="visactor_window",yx.prefix_count=0,yx=fx=vx([La(),_x("design:paramtypes",[])],yx);const bx=new ba((t=>{t(yx).toSelf(),t(Rh).toDynamicValue((t=>t.container.get(yx))).whenTargetNamed(yx.env)}));var xx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Ax{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function kx(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Mx=class extends ly{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(k(l)?l:1),y:(i-a.top)/(k(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Ax(t)}return new Jt}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return kx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return kx(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ya.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Mx=xx([La(),Sx("design:paramtypes",[])],Mx);const Tx=new ba((t=>{Tx.isBrowserBound||(Tx.isBrowserBound=!0,t(Mx).toSelf().inSingletonScope(),t(to).toService(Mx))}));function Cx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Cx.__loaded||(Cx.__loaded=!0,t.load(Tx),t.load(ax),t.load(bx),e&&function(t){t.load(gx),t.load(mx)}(t))}Tx.isBrowserBound=!1,Cx.__loaded=!1;var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bx=function(t,e){return function(i,s){e(i,s,t)}};let Rx=class extends my{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new iy(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Rx=Ex([La(),Bx(0,Ba($a)),Bx(0,Oa(Sb)),Bx(1,Ba($a)),Bx(1,Oa(Ov)),Px("design:paramtypes",[Object,Object])],Rx);const Lx=new ba((t=>{Lx.__vloaded||(Lx.__vloaded=!0,Za(t,Sb))}));Lx.__vloaded=!1;var Ox=Lx,Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fx=function(t,e){return function(i,s){e(i,s,t)}};let jx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=su}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};jx=Ix([La(),Fx(0,Ba(tv)),Dx("design:paramtypes",[Object])],jx);let zx=!1;const Hx=new ba(((t,e,i,s)=>{zx||(zx=!0,t(Ab).to(jx).inSingletonScope(),t(Sb).toService(Ab))}));var Vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Wx=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=ru}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};Wx=Vx([La(),Gx(0,Ba(ev)),Nx("design:paramtypes",[Object])],Wx);let Ux=!1;const Yx=new ba(((t,e,i,s)=>{Ux||(Ux=!0,t(kb).to(Wx).inSingletonScope(),t(Sb).toService(kb))}));var Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let qx=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=au}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};qx=Kx([La(),$x(0,Ba(iv)),Xx("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new ba(((t,e,i,s)=>{Zx||(Zx=!0,t(Mb).to(qx).inSingletonScope(),t(Sb).toService(Mb))}));var Qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eS=function(t,e){return function(i,s){e(i,s,t)}};let iS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=ou}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};iS=Qx([La(),eS(0,Ba(uv)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new ba(((t,e,i,s)=>{sS||(sS=!0,t(Lb).to(iS).inSingletonScope(),t(iS).toService(Lb))}));var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let aS=class{constructor(){this.type="image",this.numberType=hu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};aS=rS([La()],aS);let oS=!1;const lS=new ba(((t,e,i,s)=>{oS||(oS=!0,t(Tb).to(aS).inSingletonScope(),t(aS).toService(Tb))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};uS=hS([La(),dS(0,Ba(rv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new ba(((t,e,i,s)=>{pS||(pS=!0,t(wb).to(uS).inSingletonScope(),t(Sb).toService(wb))}));var mS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vS=function(t,e){return function(i,s){e(i,s,t)}};let _S=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};_S=mS([La(),vS(0,Ba(ov)),fS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new ba(((t,e,i,s)=>{yS||(yS=!0,t(Rb).to(_S).inSingletonScope(),t(Sb).toService(Rb))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};kS=xS([La(),AS(0,Ba(av)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new ba(((t,e,i,s)=>{MS||(MS=!0,t(Cb).to(kS).inSingletonScope(),t(Sb).toService(Cb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ES=function(t,e){return function(i,s){e(i,s,t)}};const PS=new Jt;let BS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=pu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;PS.setValue(i.x1,i.y1,i.x2,i.y2),PS.expand(-r/2),h=!PS.containsPoint(e)}}return s.highPerformanceRestore(),h}};BS=wS([La(),ES(0,Ba(lv)),CS("design:paramtypes",[Object])],BS);let RS=!1;const LS=new ba(((t,e,i,s)=>{RS||(RS=!0,t(Eb).to(BS).inSingletonScope(),t(Sb).toService(Eb))}));let OS=!1;const IS=new ba(((t,e,i,s)=>{OS||(OS=!0,t(Tb).to(aS).inSingletonScope(),t(aS).toService(Tb))}));var DS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jS=function(t,e){return function(i,s){e(i,s,t)}};let zS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=mu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};zS=DS([La(),jS(0,Ba(hv)),FS("design:paramtypes",[Object])],zS);let HS=!1;const VS=new ba(((t,e,i,s)=>{HS||(HS=!0,t(Pb).to(zS).inSingletonScope(),t(Sb).toService(Pb))}));var NS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let GS=class{constructor(){this.type="text",this.numberType=fu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};GS=NS([La()],GS);let WS=!1;const US=new ba(((t,e,i,s)=>{WS||(WS=!0,t(Bb).to(GS).inSingletonScope(),t(Sb).toService(Bb))})),YS=new ba(((t,e,i,s)=>{i(Rx)||t(Rx).toSelf().inSingletonScope(),i(Bv)?s(Bv).toService(Rx):t(Bv).toService(Rx)}));var KS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $S=class extends ex{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};$S.env="node",$S=KS([La(),XS("design:paramtypes",[Object,Number])],$S);var qS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JS=class extends ay{constructor(t){super(t)}init(){this._context=new $S(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};JS.env="node",JS=qS([La(),ZS("design:paramtypes",[Object])],JS);const QS=rx(JS,$S);var tA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iA=function(t,e){return function(i,s){e(i,s,t)}};let sA=class extends dy{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ya.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new JS(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new JS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};sA.env="node",sA=tA([La(),iA(0,Ba(eo)),eA("design:paramtypes",[Object])],sA);const nA=new ba((t=>{t(sA).toSelf(),t(Rh).toDynamicValue((t=>t.container.get(sA))).whenTargetNamed(sA.env)}));var rA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let aA=class extends ly{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ic.call(t)}}getCancelAnimationFrame(){return t=>{Ic.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};aA=rA([La()],aA);const oA=new ba((t=>{oA.isNodeBound||(oA.isNodeBound=!0,t(aA).toSelf().inSingletonScope(),t(to).toService(aA))}));function lA(t){lA.__loaded||(lA.__loaded=!0,t.load(oA),t.load(QS),t.load(nA))}oA.isNodeBound=!1,lA.__loaded=!1;var hA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let cA=class extends ex{draw(){}createPattern(t,e){return null}};cA.env="wx",cA=hA([La()],cA);var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let pA=class extends ay{constructor(t){super(t)}init(){this._context=new cA(this,this._dpr)}release(){}};pA.env="wx",pA=dA([La(),uA("design:paramtypes",[Object])],pA);const gA=rx(pA,cA);var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vA=function(t,e){return function(i,s){e(i,s,t)}};class _A{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let yA=class extends dy{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new _A}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ya.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new pA(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new pA({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};yA.env="wx",yA=mA([La(),vA(0,Ba(eo)),fA("design:paramtypes",[Object])],yA);const bA=new ba((t=>{t(yA).toSelf(),t(Rh).toDynamicValue((t=>t.container.get(yA))).whenTargetNamed(yA.env)}));var xA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AA=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let kA=class extends ly{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,s,n,r){return AA(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=s&&n.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Ic.call(t)}}getCancelAnimationFrame(){return t=>{Ic.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};kA=xA([La(),SA("design:paramtypes",[])],kA);const MA=new ba((t=>{MA._isWxBound||(MA._isWxBound=!0,t(kA).toSelf().inSingletonScope(),t(to).toService(kA))}));function TA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];TA.__loaded||(TA.__loaded=!0,t.load(MA),t.load(gA),t.load(bA),e&&function(t){t.load(Ox),t.load(YS),t.load(Hx),t.load(Yx),t.load(Jx),t.load(nS),t.load(lS),t.load(gS),t.load(bS),t.load(TS),t.load(LS),t.load(IS),t.load(VS),t.load(US)}(t))}MA._isWxBound=!1,TA.__loaded=!1;var wA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EA=function(t,e){return function(i,s){e(i,s,t)}};let PA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=su}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=bm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};PA=wA([La(),EA(0,Ba(tv)),CA("design:paramtypes",[Object])],PA);let BA=!1;const RA=new ba(((t,e,i,s)=>{BA||(BA=!0,t(Ob).to(PA).inSingletonScope(),t(Kb).toService(Ob))}));var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,s){e(i,s,t)}};const DA=new Jt;let FA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=pu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=bm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;DA.setValue(i.x1,i.y1,i.x2,i.y2),DA.expand(-r/2),h=!DA.containsPoint(e)}}return s.highPerformanceRestore(),h}};FA=LA([La(),IA(0,Ba(lv)),OA("design:paramtypes",[Object])],FA);let jA=!1;const zA=new ba(((t,e,i,s)=>{jA||(jA=!0,t(Hb).to(FA).inSingletonScope(),t(Kb).toService(Hb))}));var HA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let VA=class extends vm{};VA=HA([La()],VA);var NA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=cu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=Kh(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=bm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&sm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};UA=NA([La(),WA(0,Ba(rv)),GA("design:paramtypes",[Object])],UA);let YA=!1;const KA=new ba(((t,e,i,s)=>{YA||(YA=!0,t(jb).to(UA).inSingletonScope(),t(Kb).toService(jb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=ru}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=bm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ZA=XA([La(),qA(0,Ba(ev)),$A("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new ba(((t,e,i,s)=>{JA||(JA=!0,t(Ib).to(ZA).inSingletonScope(),t(Kb).toService(Ib))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ek=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ik=function(t,e){return function(i,s){e(i,s,t)}};let sk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=mu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=Kh(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=bm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&sm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};sk=tk([La(),ik(0,Ba(hv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new ba(((t,e,i,s)=>{nk||(nk=!0,t(Vb).to(sk).inSingletonScope(),t(Kb).toService(Vb))}));var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=au}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=bm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hk=ak([La(),lk(0,Ba(iv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new ba(((t,e,i,s)=>{ck||(ck=!0,t(Db).to(hk).inSingletonScope(),t(Kb).toService(Db))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=fu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=Kh(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=cp(a,u,n),v=hp(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&sm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};mk=uk([La(),gk(0,Ba(cv)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new ba(((t,e,i,s)=>{fk||(fk=!0,t(Nb).to(mk).inSingletonScope(),t(Kb).toService(Nb))}));var _k=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=du}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=bm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&sm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};xk=_k([La(),bk(0,Ba(av)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new ba(((t,e,i,s)=>{Sk||(Sk=!0,t(zb).to(xk).inSingletonScope(),t(Kb).toService(zb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tk=function(t,e){return function(i,s){e(i,s,t)}};let wk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=uu}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Kh(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=bm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};wk=kk([La(),Tk(0,Ba(ov)),Mk("design:paramtypes",[Object])],wk);let Ck=!1;const Ek=new ba(((t,e,i,s)=>{Ck||(Ck=!0,t(Gb).to(wk).inSingletonScope(),t(Kb).toService(Gb))}));var Pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=ou}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}};Lk=Pk([La(),Rk(0,Ba(uv)),Bk("design:paramtypes",[Object])],Lk);let Ok=!1;const Ik=new ba(((t,e,i,s)=>{Ok||(Ok=!0,t(Ub).to(Lk).inSingletonScope(),t(Kb).toService(Ub))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};zk=Dk([La(),jk(0,Ba(dv)),Fk("design:paramtypes",[Object])],zk);let Hk=!1;const Vk=new ba(((t,e,i,s)=>{Hk||(Hk=!0,t(Wb).to(zk).inSingletonScope(),t(Kb).toService(Wb))}));var Nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gk=class{constructor(){this.type="image",this.numberType=hu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Gk=Nk([La()],Gk);let Wk=!1;const Uk=new ba(((t,e,i,s)=>{Wk||(Wk=!0,t(Fb).to(Gk).inSingletonScope(),t(Kb).toService(Fb))})),Yk=X_();function Kk(){Kk.__loaded||(Kk.__loaded=!0,um.RegisterGraphicCreator("arc",Kg),$l.load(yy),$l.load(Yk?RA:Hx))}Kk.__loaded=!1;const Xk=Kk;function $k(){$k.__loaded||($k.__loaded=!0,um.RegisterGraphicCreator("area",Wg),$l.load(My),$l.load(Yk?QA:Yx))}$k.__loaded=!1;const qk=$k;function Zk(){Zk.__loaded||(Zk.__loaded=!0,um.RegisterGraphicCreator("circle",op),$l.load(Ey),$l.load(Yk?dk:Jx))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,um.RegisterGraphicCreator("glyph",wg),$l.load(zy),$l.load(Yk?Ik:nS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,um.RegisterGraphicCreator("group",Au))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,um.RegisterGraphicCreator("image",Rg),$l.load(Yy),$l.load(Yk?Uk:lS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,um.RegisterGraphicCreator("line",Sg),$l.load(Ay),$l.load(Yk?KA:gS))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,um.RegisterGraphicCreator("path",Vg),$l.load(Ly),$l.load(Yk?Ak:TS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,um.RegisterGraphicCreator("polygon",qg),$l.load(Iy),$l.load(Yk?Ek:bS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,um.RegisterGraphicCreator("rect",Mg),$l.load(xy),$l.load(Yk?zA:LS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,um.RegisterGraphicCreator("richtext",jg),$l.load(Wy),$l.load(Yk?Vk:IS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,um.RegisterGraphicCreator("shadowRoot",Jg))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,um.RegisterGraphicCreator("symbol",yg),$l.load(wy),$l.load(Yk?rk:VS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,um.RegisterGraphicCreator("text",gp),$l.load(By),$l.load(Yk?vk:US))}yM.__loaded=!1;const bM=yM;function xM(){iM(),uM()}const SM=-.5*Math.PI,AM=1.5*Math.PI,kM="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var MM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(MM||(MM={}));const TM={[MM.selectedReverse]:{},[MM.selected]:{},[MM.hover]:{},[MM.hoverReverse]:{}},wM={container:"",width:30,height:30,style:{}},CM={debounce:bt,throttle:xt};xM();let EM=class t extends xb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=ft(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ft(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===E_.env?(E_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),E_.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:CM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:vt(o,s[0],s[1])}),"browser"===E_.env?(E_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),E_.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=vt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",CM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(vt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ti(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ti(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=vt(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?vt([a+i*n,a+s*n],a,n-l):vt([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function PM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&PM(t,e)}))}EM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const BM=t=>!u(t)&&!1!==t.visible;function RM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const IM=["#ffffff","#000000"];function DM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ve(t).toHex(),o=new ve(e).toHex();return FM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...IM);for(const n of a)if(t!==n&&FM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function FM(t,e,i,s,n){if("lightness"===n){const i=ve.getColorBrightness(new ve(e));return ve.getColorBrightness(new ve(t))<.5?i>=.5:i<.5}return s?jM(t,e)>s:"largeText"===i?jM(t,e)>3:jM(t,e)>4.5}function jM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(t){const e=ye(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function HM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function VM(t,e){return[t[0]*e,t[1]*e]}function NM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const GM=(t,e,i,s)=>new Je(Object.assign({defaultFontParams:Object.assign({fontFamily:kM,fontSize:14},s),getTextBounds:i?void 0:mm,specialCharSet:"-/: .,@%'\"~"+Je.ALPHABET_CHAR_SET+Je.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=mm({text:t,fontFamily:e.fontFamily||i.fontFamily||kM,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function UM(t){return"rich"===YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function YM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function KM(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function XM(t){const e=YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?um.richtext(KM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),um.text(t))}function $M(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const qM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function ZM(){iM(),uM(),_M(),gM(),bM()}var JM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(k=h,P.setAttribute("maxLineWidth",h-b[1]-b[2])));let I=0,D=0,F=0;"left"===L||"start"===L?F=1:"right"===L||"end"===L?F=-1:"center"===L&&(F=0),F?F<0?(I-=k,A&&A.setAttribute("x",(A.attribute.x||0)-v),x.setAttribute("x",-b[1]-w)):F>0&&x.setAttribute("x",b[3]):(I-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-v/2),x.setAttribute("x",-w/2));const j="right"===y||"end"===y,z="left"===y||"start"===y;if((y?"center"===y:_)&&F){const t=k-b[1]-b[3],e=v+w,i=1===F?(t-e)/2+w+v/2:b[0]+w-(k/2+e/2-w)+v/2;if(P.setAttributes({x:i,textAlign:"center"}),A){const t=i-v/2-w+R/2;A.setAttributes({x:t})}}if(z&&1!==F){const t=k-b[1]-b[3],e=0===F?-t/2+w/2:-k+b[3]+b[1]+w,i=e+w;if(P.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(j&&-1!==F){const t=k-b[1]-b[3],e=0===F?t/2+w/2:t;if(P.setAttributes({x:e,textAlign:"right"}),A){const t=e-v-w+R/2;A.setAttributes({x:t})}}"middle"===O?(D-=M/2,A&&A.setAttribute("y",0)):"bottom"===O?(D-=M,A&&A.setAttribute("y",-C/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",C/2));const{visible:H}=a,V=JM(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");B(null==f?void 0:f.panel)||(t.states=f.panel),this._bgRect=t}}this._textShape=P}}QM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tT={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},eT={poptip:z({},tT)};var iT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GAe&&([Se,Ae]=[Ae,Se]),ke>Me&&([ke,Me]=[Me,ke]),Te>we&&([Te,we]=[we,Te]),Ce>Ee&&([Ce,Ee]=[Ee,Ce])),Se>Te&&AeCe&&MeSe&&weke&&EeQ&&(Q=n,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Ct/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Ct/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Ct/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Ct/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Ct/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Ct/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Ct,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Ct,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Ct,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}nT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var rT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let aT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,nT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new nT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,eT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};aT=rT([La()],aT);var oT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};lT=oT([La()],lT);let hT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};hT=oT([La()],hT);const cT=new ba(((t,e,i,s)=>{i(aT)||(t(aT).toSelf().inSingletonScope(),t(np).toService(aT)),i(lT)||(t(lT).toSelf(),t(Hv).toService(lT)),i(hT)||(t(hT).toSelf(),t(Hv).toService(hT))}));class dT extends xb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}iM(),aM();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},iM(),uM();class pT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pT.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}pT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},iM(),Xk();class gT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=$t.distancePP(t,e);this.setAttribute("radius",i)}}gT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},iM(),Xk();class mT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=SM,endAngle:s=AM}=this.attribute,n=s-i,r=te(se(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}mT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},iM(),lM();class fT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ie(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=$t.distancePP(t,e);this.setAttribute("radius",i)}}fT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const vT=new Uint32Array(33),_T=new Uint32Array(33);_T[0]=0,vT[0]=~_T[0];for(let t=1;t<=32;++t)_T[t]=_T[t-1]<<1|1,vT[t]=~_T[t];function yT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&vT[31&l]&_T[1+(31&h)])return!0}else{if(i[c]&vT[31&l])return!0;if(i[d]&_T[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,vT[31&n]&_T[1+(31&r)]);else for(s(a,vT[31&n]),s(o,_T[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,_T[31&i]|vT[1+(31&s)]);else for(n(r,_T[31&i]),n(a,vT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function bT(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=ft(i,0,t.width),o=ft(s,0,t.width),l=ft(n,0,t.height),h=ft(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function xT(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=bT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function ST(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return ST(t,e,n,o,h,c)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return ST(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return ST(t,e,n,s,h,c)}return!1}const kT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],MT=["top","inside-top","inside"];function TT(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const wT={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function CT(t,e){var i,s;return null!==(s=null===(i=wT[e])||void 0===i?void 0:i.call(wT,t))&&void 0!==s?s:{from:{},to:{}}}const ET=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function PT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Fc({text:t.attribute.text},{text:e.attribute.text},i,s))}const BT={mode:"same-time",duration:300,easing:"linear"};function RT(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function LT(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function OT(t){return 3===t||4===t}function IT(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const DT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}},FT=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function jT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function zT(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}iM(),bM(),gM(),aM();class HT extends xb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(MM.hover,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(PM(this,(t=>{B(t.states)||(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void PM(this,(t=>{B(t.states)||(t.removeState(MM.selectedReverse),t.removeState(MM.selected))}));B(e.states)||(e.addState(MM.selected,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===xo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===xo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(Oe(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[zT(g,m,c,d,a,o),zT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=um.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return XM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&y.setRange(bT(v,t.AABBBounds,!0))}))),m.length>0&&m.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&y.setRange(bT(v,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(bT(v,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=CT(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&PT(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=ET(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&PT(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(CT(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==xo.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===xo.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,bo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.pickerService)||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",m=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}VT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class NT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NT.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=Qe(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}NT.tag="rect-label",NT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let GT=class t extends HT{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};GT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class WT{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class UT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=LT(l.endAngle-d/2),p=RT(h.x,h.y,l.outerRadius,o),g=RT(h.x,h.y,a+e.line.line1MinLength,o),m=new WT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=RT(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):OT(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:u+l-_,t.labelPosition=RT(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=m,pt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=OT(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=OT(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,l+c)||pt(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;k(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const m=this.computeRadius(o,e.width,e.height),f=OT(p)?-1:1;let v=0,_=(f>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(m+l+h)*f+n.x,_=(f>0?r-v:v)-d);const y=this._getFormatLabelText(t.refDatum,_);t.labelText=y;let b=Math.min(_,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=f>0?r-b-d:b+d;break;default:v=g.x+f*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-f*x}else{const t=0;u.x=v+t+f*(d+x)}}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?OT(t.quadrant)?"left":"right":OT(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;k(c)?t.pointB={x:s.x+c*(OT(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(ut(l/2,u))g=0,m=1,f=-p;else if(ut(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ut(v[0].y,v[1].y)?pt(t.middleAngle,-Math.PI)&>(t.middleAngle,0)||pt(t.middleAngle,Math.PI)&>(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}YT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class KT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return DT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}KT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const XT={rect:NT,symbol:VT,arc:UT,line:GT,area:YT,"line-data":KT};class $T extends xb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$T.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!k(n*s))return;this._componentMap||(this._componentMap=new Map);const a=yT(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function qT(){iM(),aM(),cM(),_M()}function ZT(){iM(),aM(),Xk(),_M()}$T.defaultAttributes={pickable:!1},qT();class JT extends xb{getStartAngle(){return ne(this._startAngle)}getEndAngle(){return ne(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(k(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=um.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=um.line;Y(i)[0].cornerRadius&&(t=um.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=um.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}JT.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},ZT();class QT extends JT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=um.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var tw,ew;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(tw||(tw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ew||(ew={}));const iw={[ew.selectedReverse]:{},[ew.selected]:{},[ew.hover]:{},[ew.hoverReverse]:{}},sw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},nw=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Pt;else if(t>0)for(;t>Pt;)t-=Pt;return t};function rw(t,e,i){return!gt(t,e,0,1e-6)&&!pt(t,i,0,1e-6)}function aw(t,e,i,s){const n=mm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=nw(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=rw(o,-l,-h)?((o+l)/c-.5)*r:rw(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let m=0;return m=rw(o,-l,-h)?.5*-a:rw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-nw(o-l)/c)*a,{x:p,y:g-m}}function ow(t){const e={};return PM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function hw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return VM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const cw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(MM.hover,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.hoverReverse,!0)})),s):i},dw=(t,e,i)=>i?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),null):i,uw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(MM.selected)?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.selectedReverse),t.removeState(MM.selected))})),null):s.name&&!B(s.states)?(s.addState(MM.selected,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.selectedReverse,!0)})),s):i};class pw extends xb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);z(this.attribute,t);const i=um.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=um.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=um.group({x:0,y:0,zIndex:1});if(a.name=tw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=um.group({x:0,y:0,pickable:!1});t.name=tw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=um.group({x:0,y:0,pickable:!1});i.name=tw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=um.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=TM;else{const t=this.data[s],e=z({},TM,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=um.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=TM;else{const i=z({},TM,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=um.group({x:0,y:0,pickable:!1});return r.name=`${tw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=tw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=TM;else{const s=z({},TM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new QM(Object.assign({},e));i.name=tw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return lw(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return ut(t[0],0)?ut(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Rt(s[0])>Rt(s[1])?o=Ct/2*(l.x>e.x?1:-1):h=Ct/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},sw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function gw(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function mw(t,e){return Oe(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=ze(t,i),r=ze(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=je(t),l=je(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Qt(t.angle);let m=i?t.angle+Et:Qt(90-t.angle);const f=i?e.angle:Qt(e.angle);let v=i?e.angle+Et:Qt(90-e.angle);m>Bt&&(m-=Bt),v>Bt&&(v-=Bt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(De(n,i)+De(n,s))/2>De(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const fw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function vw(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function _w(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function bw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Aw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},kw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),gw(e)}function Sw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Aw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Sw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function kw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Sw(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class Mw{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return VM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Tw(){iM(),aM(),gM(),bM()}var ww=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=_[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=NM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:T},a),state:{text:z({},iw,c.text),shape:z({},iw,c.shape),panel:z({},iw,c.background)}});return E.angle=w,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return ut(t[1],0)?i=!ut(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Aw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kw(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=K(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:p,autoLimit:g,limitEllipsis:m,autoHide:f,autoHideMethod:v,autoHideSeparation:_,lastVisible:y}=a;if(d(h))h(t,e,s,this);else{if(c&&function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=Qt(e)})),xw(i,t),!bw(t))break}}(t,{labelRotateAngle:p,orient:o}),g&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!k(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!u(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,p=!h||Math.abs(d)<=o,g=h&&Math.abs(c)<=o,m="top"===r||"bottom"===r;if(m){if(g&&Math.floor(t.AABBBounds.height())<=i)return;if(p&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!m){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(p&&Math.floor(t.AABBBounds.width())<=i)return;if(g&&Math.floor(t.AABBBounds.height())<=s)return}}let v=null;if(p||g)v=m?p?s:i:"vertical"===f||g?s:i;else if(m){const{x1:e,x2:s}=t.AABBBounds,n=d/c;v=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else v=Math.abs(i/c);k(t.attribute.maxLineWidth)&&(v=k(v)?Math.min(t.attribute.maxLineWidth,v):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:v,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:m,orient:o,axisLength:i})}f&&function(t,e){if(B(t))return;const i=t.filter(yw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),gw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fw[n]||fw.parity;if(s.length>=3&&_w(s,r)){do{s=a(s,r)}while(s.length>=3&&_w(s,r));if(s.length<3||e.lastVisible){const t=K(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&vw(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:v,separation:_,lastVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(k(c)&&(!k(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=um.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=WM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ti(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}}Cw.defaultAttributes=sw,U(Cw,Mw);class Ew{isInValidValue(t){const{startAngle:e=SM,endAngle:i=AM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=SM,endAngle:i=AM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ie(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return hw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var Pw,Bw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(l=r,h=0);const c=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),a.style),d=um.circle(c);d.name=tw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},iw,a.state)),t.add(d)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=Bw(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},iw,d.text),shape:z({},iw,d.shape),panel:z({},iw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return aw(t,e,i,s)}}Rw.defaultAttributes=sw,U(Rw,Ew);class Lw extends gc{constructor(){super(...arguments),this.mode=Ao.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},PM(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=I(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=k(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=kt.lastIndex=Mt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=kt.exec(t))&&(s=Mt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:St(i,s)})),r=Mt.lastIndex;return r{Iw[t]=!0}));const Hw=t=>-Math.log(-t),Vw=t=>-Math.exp(-t),Nw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Gw=t=>10===t?Nw:t===Math.E?Math.exp:e=>Math.pow(t,e),Ww=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Uw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Yw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Kw(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function Xw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function $w(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function qw(t,e,i,s){return 1===i&&(i=0),$w(t,i,s)*(e/(1-i))}function Zw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Jw(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class eC{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=Zw(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ft(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const iC=Symbol("implicit");class sC extends eC{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Pw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new sC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==iC)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class rC extends sC{constructor(t){super(),this.type=Pw.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=qw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:nC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return nC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new rC(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:aC}=be;function oC(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=ve.parseColorString(e)){const e=aC(ve.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof _e?aC(t,e):e instanceof ve?aC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):St(Number(t),Number(e))}class lC extends eC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zw,this._piecewise=Xw,this._interpolate=oC}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),St)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=At,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?Jw:Xw,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:zw),this.rescale(i)):this._clamp!==zw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const hC=Math.sqrt(50),cC=Math.sqrt(10),dC=Math.sqrt(2),uC=[1,2,5,10],pC=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=vC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?mC(0,-(e-1)/s,s):mC((e-1)/s,0,s)},gC=mt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return pC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pC(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=mC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=mC(t,e,l);return n&&r.reverse(),r})),vC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uC[0];return i>=hC?s=uC[3]:i>=cC?s=uC[2]:i>=dC&&(s=uC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _C(t,e,i){const s=(e-t)/Math.max(0,i);return vC(s)}function yC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=_C(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function xC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const SC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AC=mt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),kC=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=fC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SC(t,e,n):SC(t,e,tC(n)),h=SC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),MC=mt(((t,e,i,s,n)=>yC(s(t),s(e),i).map((t=>tC(n(t))))));class TC extends lC{constructor(){super(...arguments),this.type=Pw.Linear}clone(){return(new TC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return gC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=fC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return yC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=xC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=bC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=bC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=bC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function wC(t){return e=>-t(-e)}function CC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class EC extends lC{constructor(){super(Ww(10),Gw(10)),this.type=Pw.Log,this._limit=CC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new EC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=Ww(this._base),s=Gw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=wC(i),this._pows=wC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=Hw,this.untransformer=Vw):(this._logs=i,this._pows=s,this._limit=CC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return zw}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return AC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return kC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=xC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Qw(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class PC extends TC{constructor(){super(Uw(1),Yw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new PC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=Uw(t),this.untransformer=Yw(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return AC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return kC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=xC(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Qw(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class BC{constructor(){this.type=Pw.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&k(+t)?this._range[at(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new BC).domain(this._domain).range(this._range).unknown(this._unknown)}}const RC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Jt(t).expand(i/2),n=new Jt(e).expand(i/2);return s.intersects(n)};function OC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function IC(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=Qt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=GM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,A=p*x;let k,M,T=S,w=A;a&&c&&0===s?T=DC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=DC(S,y,m[m.length-1],m[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=y:"center"===k&&(T-=y/2),a&&d&&0===s?w=DC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=DC(A,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?w-=b:"middle"===M&&(w-=b/2);const C=(new Jt).set(T,w,T+y,w+b);return h&&C.rotate(h,S,A),C}));return f},jC=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=GM(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),m=Math.max(p,12),f=t.scale(e);let v=0,_=0;const y=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=ie({x:0,y:0},i,t),l=lw(o,hw(s,o,e,n));return aw(l,hw(s||1,l,e,n),r,a)}(f,{x:0,y:0},h,a,l,r,n);return v=x+("right"===y?-g:"center"===y?-g/2:0),_=S+("bottom"===b?-m:"middle"===b?-m/2:0),(new Jt).set(v,_,v+g,_+m).rotate(c,v+g/2,_+m/2)}));return u},zC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&OC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},HC=(t,e,i,s)=>FC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),VC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},NC=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!VC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?NC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},UC=(t,e)=>{if(Dw(t.type))return((t,e)=>{if(!Dw(t.type))return RC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return RC([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(p(a))h=t.stepTicks(a);else if(p(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=d(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=FC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&IC(n,i);)n=zC.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),K(r)!==K(h)&&r.push(K(h))),h=r}return RC(h)})(t,e);if(jw(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?RC([s[s.length-1]]):RC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=HC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=GC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=HC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return RC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=jC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return RC(c)})(t,e)}return RC(t.domain())};function YC(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function KC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=$t.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function XC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=YC(t,!!n),o=YC(r,!!n);const h=$t.distancePP(s,l),c=$t.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=KC(e,t,!1,!!n),o=KC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=YC(t,!!n),o=YC(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class $C extends xb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=um.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return lw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${tw.grid}-sub`:`${tw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=YC(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=KC(t,o,!1,!!a)}const u=um.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:$C.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=YC(o,!!a),f=Rt(o[0].x-o[1].x),v=Rt(o[0].y-o[1].y),_=um.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Ct/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:$C.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=z({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}U(qC,Mw);var ZC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=z({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(JC,Ew);const QC="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",tE={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},eE={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var iE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(iE||(iE={}));var sE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=iE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=iE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=iE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===E_.env&&(E_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===iE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===iE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=iE.endHandler):h+=l:this._activeTag===iE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===iE.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===E_.env&&(E_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ft(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===iE.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ft(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===iE.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=sE(i,["formatMethod"]),{formatMethod:a}=s,o=sE(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,m={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let f,v,_,y;this._isHorizontal?(f={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},_={textAlign:this.isTextOverflow(m,t,"start")?"left":"right",textBaseline:"middle"},y={textAlign:this.isTextOverflow(m,e,"end")?"right":"left",textBaseline:"middle"}):(f={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},_={textAlign:"center",textBaseline:this.isTextOverflow(m,t,"start")?"top":"bottom"},y={textAlign:"center",textBaseline:this.isTextOverflow(m,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},r,{text:p,x:f.x,y:f.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,z({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Zt).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:N?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:N?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:N?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},eE.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},eE.horizontal),V),{pickable:!G&&(null===(b=V.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},eE.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},eE.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=z.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},eE.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=V.symbolType)&&void 0!==R?R:"square"},eE.vertical),V),{pickable:!G&&(null===(L=V.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},eE.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},eE.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return vy(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new QM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var aE,oE,lE,hE;function cE(){iM(),ZM()}function dE(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function uE(t,e){const{dx:i,dy:s}=dE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}rE.defaultAttributes=tE,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(aE||(aE={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(oE||(oE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(lE||(lE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(hE||(hE={}));class pE extends xb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=um.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=um.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=um.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function gE(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function mE(t,e,i,s){t&&(gE(t.startSymbol,e,i,s),t.lines.forEach((t=>gE(t,e,i,s))),gE(t.line,e,i,s),gE(t.endSymbol,e,i,s))}function fE(t,e,i,s){t&&(gE(t.getTextShape(),e,i,s),gE(t.getBgRect(),e,i,s))}function vE(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function _E(t,e,i,s){t&&(vE(t.startSymbol,e,i,s),t.lines.forEach((t=>vE(t,e,i,s))),vE(t.line,e,i,s),vE(t.endSymbol,e,i,s))}function yE(t,e,i,s){t&&(vE(t.getTextShape(),e,i,s),vE(t.getBgRect(),e,i,s))}function bE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;gE(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),gE(t.endSymbol,s+r+a,o,n),gE(e.getTextShape(),s+r+a+o,l,n),gE(e.getBgRect(),s+r+a+o,l,n)}function xE(t,e,i,s,n){mE(t,s,i,n),fE(e,s,i,n)}function SE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function AE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function kE(t,e,i,s,n,r){var a;mE(t,n,s,r),gE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fE(i,n,s,r):gE(i,n,s,r)}function ME(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;gE(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),gE(e,n+o+l,h,r),gE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(gE(i.getTextShape(),n+o+l+h+c,d,r),gE(i.getBgRect(),n+o+l+c,d,r)):gE(i,n+o+l+c,d,r)}function TE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?bE(t,e,s,r,a):"fadeIn"===i&&xE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?bE(t,e,s,n,a):"fadeIn"===i&&xE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function wE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&SE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function CE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&AE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&AE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function EE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?kE(n,r,e,i,s,o):"callIn"===t&&ME(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?kE(n,r,e,i,s,a):"callIn"===t&&ME(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;_E(t,n,s,r),vE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?yE(i,n,s,r):vE(i,n,s,r)}(n,r,e,t,i,s)}}const PE={type:"clipIn",duration:500,easing:"linear",delay:0},BE={type:"fadeIn",duration:500,easing:"linear",delay:0},RE={type:"callIn",duration:500,easing:"linear",delay:0},LE={type:"fadeOut",duration:500,easing:"linear",delay:0};class OE extends pE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=PE,this.defaultExitAnimation=LE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;uE(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new QM(Object.assign(Object.assign({},e),{state:{panel:z({},TM,null==i?void 0:i.labelBackground),text:z({},TM,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},TM,null==e?void 0:e.labelBackground),text:z({},TM,null==e?void 0:e.label)}})),this.setLabelPos())}}const IE=.001,DE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:aE.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},FE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},jE={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:lE.arcOuterMiddle,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zE={interactive:!0,label:{position:oE.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},HE={interactive:!0,label:{position:lE.arcOuterMiddle,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},VE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},NE={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},GE={postiveXAxis:{top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function WE(){UE._animate=TE}cE(),qT();class UE extends OE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(RM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,IE)||LM(Math.abs(e),3*Math.PI/2,IE)?OM(i,e,t):RM(e)?FE.postiveXAxis[t]:FE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new JT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}}function YE(){KE._animate=wE}UE.defaultAttributes=DE,cE(),cM();class KE extends pE{markerAnimate(t){KE._animate&&this._animationConfig&&KE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},NE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=um.polygon(Object.assign({points:e},s));r.states=z({},TM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==n?void 0:n.labelBackground),text:z({},TM,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},TM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},TM,null==s?void 0:s.labelBackground),text:z({},TM,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}KE.defaultAttributes=zE,cE(),ZT();class XE extends OE{markerAnimate(t){XE._animate&&this._animationConfig&&XE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case lE.arcInnerStart:l=s;case lE.arcOuterStart:l=s;break;case lE.arcInnerEnd:l=n;case lE.arcOuterEnd:l=n;break;case lE.center:case lE.arcInnerMiddle:case lE.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return VE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new QT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}XE.defaultAttributes=jE,cE(),Xk();class $E extends pE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$E.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case lE.center:h=(i+s)/2,c=(n+r)/2;break;case lE.arcInnerStart:h=i,c=n;break;case lE.arcOuterStart:h=s,c=n;break;case lE.arcInnerEnd:h=i,c=r;break;case lE.arcOuterEnd:h=s,c=r;break;case lE.arcInnerMiddle:h=i,c=(n+r)/2;break;case lE.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},VE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=um.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},TM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new QM(Object.assign(Object.assign({},o),{state:{panel:z({},TM,null==l?void 0:l.labelBackground),text:z({},TM,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},TM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},TM,null==o?void 0:o.labelBackground),text:z({},TM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function qE(){ZE._animate=EE}$E.defaultAttributes=HE,cE(),qT(),ZT(),_M(),nM(),aM();class ZE extends pE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=RE,this.defaultExitAnimation=LE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,IE)||LM(Math.abs(s),3*Math.PI/2,IE)?OM(t,s,n):RM(s)?GE.postiveXAxis[n]:GE.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=hE.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},TM,null==m?void 0:m.textBackground),text:z({},TM,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},TM,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},TM,null==m?void 0:m.image));const y=RM(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=um.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},TM,null==s?void 0:s.symbol)):"text"===n?h=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==s?void 0:s.textBackground),text:z({},TM,null==s?void 0:s.text)}})):"richText"===n?(h=um.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},TM,null==s?void 0:s.richText)):"image"===n?(h=um.image(Object.assign(Object.assign({},i),o)),h.states=z({},TM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},TM,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=LM(c,0,IE)||LM(d,0,IE),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=qM(s-p,t-u),o=qM(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(aP.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(aP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aP.focus||"focus"===o){const s=a.hasState(nP.focus);a.toggleState(nP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover,nP.focus],t),this._setLegendItemState(e,nP.selected,t)})):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover,nP.focus],t),this._setLegendItemState(e,nP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nP.selected,nP.selectedHover],t),this._setLegendItemState(a,nP.unSelected,t)):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t))}else this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover],t),this._setLegendItemState(e,nP.unSelected,t))}))}this._dispatchLegendEvent(rP.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,nP.selected),this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover])):(this._removeLegendItemState(e,[nP.selected,nP.selectedHover]),this._setLegendItemState(e,nP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=eP,spaceRow:h=iP}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:m}=this._itemContext,f=m?1:u?i:e;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext;for(let t=g,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),v=d[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(r)&&(e=r.includes(v.label));const i=this._renderEachItem(v,e,t,d),g=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(g,b),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(m&&o?(A=Math.ceil((x+g)/s),_=A>1):x+g>s&&(_=!0,x>0&&(A+=1,x=0,S+=f+h))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=l+g):(p(n)&&(m&&o?(A=Math.ceil((S+f)/n),_=A>1):nthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ti(c);let w;!1===x.visible?(w=um.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aP.item,t,w)):(w=um.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nP.selected:nP.unSelected);const C=um.group({x:0,y:0,pickable:!1});w.add(C);let E,P=0,B=0,L=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,L=R(v,"space",8);const s=um.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,aP.itemShape,t,w,S.state),s.addState(e?nP.selected:nP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=um.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,aP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(Object.assign(Object.assign({x:B/2+L,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,aP.itemLabel,t,w,A.state),D.addState(e?nP.selected:nP.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=XM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,aP.itemValue,t,w,k.state),r.addState(e?nP.selected:nP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-B-L-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-T[1]-T[3]-O-s}):r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",s+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-B-L-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),V=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+T[3],-j.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute;return this._itemContext.isHorizontal?new tP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:99},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new tP(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new EM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new EM(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=o+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,_,t,m,f)}else{if(m=this._itemMaxWidth*s+(s-1)*o,f=i,v=m,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),_=i-g.AABBBounds.height()-c-t,_<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,_,t,m,f)}d>1&&(p?h.setAttribute("y",-(d-1)*(f+l)):h.setAttribute("x",-(d-1)*(m+o)));const S=um.group({x:0,y:t,width:p?v:m,height:p?f:_,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?f+l:m+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=eP,spaceRow:a=iP}=s,o=this._itemsContainer,{space:l=sP,defaultCurrent:h=1}=n,c=cP(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,m=0,f=0,v=1;if(d)p=e,g=e,m=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,m,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),m=i-t,g=this._itemMaxWidth,m<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((f+i)/m)+1,f+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,m,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(m+a)));const _=um.group({x:0,y:t,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(nP.selected)?this._setLegendItemState(t,nP.selectedHover,e):this._setLegendItemState(t,nP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nP.unSelectedHover)||t.hasState(nP.selectedHover))&&(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nP.unSelectedHover)&&!t.hasState(nP.selectedHover)||(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rP.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==aP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==aP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},dP,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(nP.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var pP;function gP(t){return y(t)?t:[t,t]}function mP(t){return t?"ew-resize":"ns-resize"}uP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eP,spaceRow:iP,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:10,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:sP,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(pP||(pP={})),lP();class fP extends xb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fP.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=ft(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===E_.env?(E_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=ft(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===E_.env?(E_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===E_.env?(E_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),E_.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?ft(t+p,h,c):ft(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?ft(t+p,0,c-h):ft(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===E_.env?(E_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),E_.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:gP(d)[0],endValue:gP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=um.group({x:0,y:0});m.name=pP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=um.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=pP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=um.group({x:g?v:0,y:g?0:v});m.add(_);const y=um.group({x:0,y:0});let b;if(y.name=pP.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=um.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=pP.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=um.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pP.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=gP(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":mP(p)},r));if(v.name=pP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":mP(p)},r));if(i.name=pP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=pP.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=vt(h,i,s);c=t[0],d=t[1]}else c=i,d=ft(h,i,s);const p=this._isHorizontal;e||(c=i);const m=um.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=pP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":mP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=um.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=pP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return um.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":mP(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),um.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=um.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=um.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===pP.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===pP.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===pP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===pP.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}fP.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}},hP(),lP();class vP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vP.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function _P(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}vP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},hP(),lP(),lM();class yP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=um.group({x:0,y:0});this._innerView.add(x);const S=new fP({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:_P(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=um.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}yP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}},iM(),bM(),gM();let bP=class t extends xb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_,b,x,S,A,k,M,T,w,C,E,P,B,R,L,O,I,D,F,j,z,H,V,N,G;const{textType:W,text:U,subtextType:Y,textStyle:K={},subtext:X,subtextStyle:$={},width:q,height:Z,minWidth:J,maxWidth:Q,minHeight:tt,maxHeight:et,align:it,verticalAlign:st,padding:nt=0}=this.attribute,rt=ti(nt),at=this.createOrUpdateChild("title-container",{x:rt[3],y:rt[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||p(K.character)){const h=Object.assign({x:null!==(t=K.x)&&void 0!==t?t:0,y:null!==(e=K.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=K.width)&&void 0!==i?i:q)&&void 0!==s?s:0,height:null!==(r=null!==(n=K.height)&&void 0!==n?n:Z)&&void 0!==r?r:0,ellipsis:null===(a=K.ellipsis)||void 0===a||a,wordBreak:null!==(o=K.wordBreak)&&void 0!==o?o:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(l=K.character)&&void 0!==l?l:U},K);this._mainTitle=at.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:U},wM),K),x:null!==(h=K.x)&&void 0!==h?h:0,y:null!==(c=K.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=K.width)&&void 0!==d?d:q)&&void 0!==u?u:0,height:null!==(m=null!==(g=K.height)&&void 0!==g?g:Z)&&void 0!==m?m:0,ellipsis:null===(f=K.ellipsis)||void 0===f||f,wordBreak:null!==(v=K.wordBreak)&&void 0!==v?v:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._mainTitle=at.createOrUpdateChild("mainTitle",t,"richtext")}else p(U)&&(this._mainTitle=at.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(U)?U:[U],wrap:!0},K),{maxLineWidth:null!==(_=K.maxLineWidth)&&void 0!==_?_:q,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(b=K.ellipsis)||void 0===b||b,x:0,y:0}),"text"));const ot=this._mainTitle?this._mainTitle.AABBBounds.height():0,lt=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==$.visible)if("rich"===Y||p($.character)){const t=Object.assign({x:null!==(x=$.x)&&void 0!==x?x:0,y:null!==(S=$.y)&&void 0!==S?S:0,width:null!==(k=null!==(A=$.width)&&void 0!==A?A:q)&&void 0!==k?k:0,height:null!==(T=null!==(M=$.height)&&void 0!==M?M:Z)&&void 0!==T?T:0,ellipsis:null===(w=$.ellipsis)||void 0===w||w,wordBreak:null!==(C=$.wordBreak)&&void 0!==C?C:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:null!==(E=$.character)&&void 0!==E?E:X},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===Y){const t=Object.assign({html:Object.assign(Object.assign({dom:X},wM),$),x:null!==(P=$.x)&&void 0!==P?P:0,y:null!==(B=$.y)&&void 0!==B?B:0,width:null!==(L=null!==(R=$.width)&&void 0!==R?R:q)&&void 0!==L?L:0,height:null!==(I=null!==(O=$.height)&&void 0!==O?O:Z)&&void 0!==I?I:0,ellipsis:null===(D=$.ellipsis)||void 0===D||D,wordBreak:null!==(F=$.wordBreak)&&void 0!==F?F:"break-word",maxHeight:$.maxHeight,maxWidth:$.maxWidth,textConfig:[]},$);this._subTitle=at.createOrUpdateChild("subTitle",t,"richtext")}else p(X)&&(this._subTitle=at.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(X)?X:[X],wrap:!0},$),{maxLineWidth:null!==(j=$.maxLineWidth)&&void 0!==j?j:q,heightLimit:$.heightLimit,lineClamp:$.lineClamp,ellipsis:null===(z=$.ellipsis)||void 0===z||z,x:0,y:ot}),"text"));const ht=this._subTitle?this._subTitle.AABBBounds.height():0,ct=this._subTitle?this._subTitle.AABBBounds.width():0;let dt=Math.max(lt,ct),ut=ot+(null!==(H=$.height)&&void 0!==H?H:ht);if(p(q)&&(dt=q,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",q),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",q)),p(Z)&&(ut=Z),p(J)&&dtQ&&(dt=Q)),p(tt)&&utet&&(ut=et)),at.attribute.width=dt,at.attribute.height=ut,at.attribute.boundsPadding=rt,this._mainTitle){if(p(it)||p(K.align)){const t=K.align?K.align:it,e=null!==(V=K.width)&&void 0!==V?V:lt;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:st,e=K.height?K.height:ut;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(it)||p($.align)){const t=$.align?$.align:it,e=null!==(N=$.width)&&void 0!==N?N:ct;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(st)||p(K.verticalAlign)){const t=$.verticalAlign?$.verticalAlign:st,e=ot,i=null!==(G=$.height)&&void 0!==G?G:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};bP.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const xP={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};iM(),bM(),gM();let SP=class extends xb{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(p(i))if(!1!==i.visible){const t=z({},R(xP,"title.style"),i.style);UM(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},KM(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:p(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&k(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&k(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(p(s)){const t=Y(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=z({},R(xP,"content.style"),t.style);let l;l=UM(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},KM(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:p(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&k(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&k(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=WM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;k(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class AP extends _g{constructor(t){super(t)}}var kP,MP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kP||(kP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(MP||(MP={}));class TP extends xb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z"},TP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z"},TP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{u(this._playController)&&(this._playController=new AP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.forward()})))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent(kP.OnPlay)},this.pause=()=>{this._dispatchEvent(kP.OnPause)},this.forward=()=>{this._dispatchEvent(kP.OnForward)},this.backward=()=>{this._dispatchEvent(kP.OnBackward)},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}TP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TP.defaultAttributes={[MP.Start]:{},[MP.Pause]:{},[MP.Backward]:{},[MP.Forward]:{}};const wP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CP=[200,10];var EP,PP;!function(t){t.Default="default",t.Reverse="reverse"}(EP||(EP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(PP||(PP={}));const BP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},RP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},LP=t=>"top"===t||"bottom"===t;class OP extends xb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=It(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(LP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:CP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new fP(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return LP(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new TP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=LP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:It(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(LP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:It(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:LP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:LP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:It(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function IP(){lP(),iM(),_M()}OP.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},wP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wP),{key:"backward",position:"start"})}},IP();class DP extends OP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:EP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(PP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(BP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||RP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(PP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=E_.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(PP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(PP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=E_.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),E_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,E_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(PP.change),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FP,jP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};IP();class zP extends OP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},this._getSliderValue=()=>{const t=this._elapsed/this._totalDuration;return Math.min(t*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const t=this._getSliderValue();this._dataIndex=Math.floor(t),this._slider.setValue(Math.min(t,this._maxIndex)),this._dispatchChange(Math.floor(t))},this._dispatchChange=t=>{const e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(PP.change))},this.play=()=>jP(this,void 0,void 0,(function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(PP.play),this._rafId=E_.getRequestAnimationFrame()(this._play.bind(this)))})),this._play=()=>{this._elapsed=Date.now()-this._startTime;const t=this._getSliderValue();this._updateSlider(),t>=this._maxIndex?this._playEnd():this._rafId=E_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,E_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,E_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(PP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(FP||(FP={}));const HP={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},VP=5;const NP={debounce:bt,throttle:xt};iM(),cM();let GP=class t extends xb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:NP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(FP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(FP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(FP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=HP.trigger,updateTrigger:e=HP.updateTrigger,endTrigger:i=HP.endTrigger,resetTrigger:s=HP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Ke(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(FP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(FP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=VP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(FP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(FP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=um.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},UP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},YP={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:kM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Jt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},KP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];iM(),uM(),_M(),bM(),gM();let XP=class t extends xb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=ti(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:BM(u)&&BM(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},wM),u.value),visible:BM(u)&&BM(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const g=BM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=BM(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!BM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(BM(n.key)?r+n.key.spacing:0)+(BM(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&($M(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:BM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),$M(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Dc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},UP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},wM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>KP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&BM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=BM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=GM(u),y=GM(p);let b=0;if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(BM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&gg[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return WP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XP.defaultAttributes=YP;const $P=ut;function qP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function ZP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QP(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function tB(t,e){const i=QP(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function eB(t,e){const i=iB(t),s=iB(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function iB(t,e={x:0,y:0}){return $t.distancePP(t,e)}function sB(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function nB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const rB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var oB,lB;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(oB||(oB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(lB||(lB={}));const hB="__VCHART",cB=500,dB=500,uB=`${hB}_LABEL_LIMIT`,pB=`${hB}_LABEL_ALIGN`,gB=`${hB}_LABEL_TEXT`,mB=`${hB}_LABEL_VISIBLE`,fB=`${hB}_LABEL_X`,vB=`${hB}_LABEL_Y`,_B=`${hB}_ARC_TRANSFORM_VALUE`,yB=`${hB}_ARC_RATIO`,bB=`${hB}_ARC_START_ANGLE`,xB=`${hB}_ARC_END_ANGLE`,SB=`${hB}_ARC_K`,AB=`${hB}_ARC_MIDDLE_ANGLE`,kB=`${hB}_ARC_QUADRANT`,MB=`${hB}_ARC_RADIAN`,TB=-Math.PI/2,wB=3*Math.PI/2,CB=-90,EB=.6;var PB,BB,RB,LB,OB,IB,DB,FB,jB,zB,HB,VB,NB,GB,WB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(PB||(PB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(BB||(BB={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(RB||(RB={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(LB||(LB={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(OB||(OB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(DB||(DB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(FB||(FB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(jB||(jB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zB||(zB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(HB||(HB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(VB||(VB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(NB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",NB.AFTER_EVALUATE_DATA="afterEvaluateData",NB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",NB.AFTER_EVALUATE_SCALE="afterEvaluateScale",NB.BEFORE_PARSE_VIEW="beforeParseView",NB.AFTER_PARSE_VIEW="afterParseView",NB.BEFORE_TRANSFORM="beforeTransform",NB.AFTER_TRANSFORM="afterTransform",NB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",NB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",NB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",NB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",NB.BEFORE_STAGE_RESIZE="beforeStageResize",NB.AFTER_STAGE_RESIZE="afterStageResize",NB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",NB.AFTER_VRENDER_DRAW="afterVRenderDraw",NB.BEFORE_MARK_JOIN="beforeMarkJoin",NB.AFTER_MARK_JOIN="afterMarkJoin",NB.BEFORE_MARK_UPDATE="beforeMarkUpdate",NB.AFTER_MARK_UPDATE="afterMarkUpdate",NB.BEFORE_MARK_STATE="beforeMarkState",NB.AFTER_MARK_STATE="afterMarkState",NB.BEFORE_MARK_ENCODE="beforeMarkEncode",NB.AFTER_MARK_ENCODE="afterMarkEncode",NB.BEFORE_DO_LAYOUT="beforeDoLayout",NB.AFTER_DO_LAYOUT="afterDoLayout",NB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",NB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",NB.BEFORE_DO_RENDER="beforeDoRender",NB.AFTER_DO_RENDER="afterDoRender",NB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",NB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",NB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",NB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",NB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",NB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",NB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",NB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",NB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",NB.BEFORE_ELEMENT_STATE="beforeElementState",NB.AFTER_ELEMENT_STATE="afterElementState",NB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",NB.AFTER_ELEMENT_ENCODE="afterElementEncode",NB.ANIMATION_START="animationStart",NB.ANIMATION_END="animationEnd",NB.ELEMENT_ANIMATION_START="elementAnimationStart",NB.ELEMENT_ANIMATION_END="elementAnimationEnd",NB.ALL_ANIMATION_START="allAnimationStart",NB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(GB||(GB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(WB||(WB={}));const UB="__vgrammar_scene_item__",YB=[RB.line,RB.area],KB=[RB.arc3d,RB.rect3d,RB.pyramid3d],XB="key",$B=[{}],qB=["key"],ZB=!0,JB=!0,QB=!1,tR=!0,eR="VGRAMMAR_IMMEDIATE_ANIMATION",iR=0,sR=1e3,nR=0,rR=0,aR=!1,oR=!1,lR="quintInOut",hR={stopWhenStateChange:!1,immediatelyApply:!0};function cR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function dR(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return cR(t.dependency,e);var i;return[]}function uR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pR(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function gR(t,e){return mR(t)?t.output():e[t]}const mR=t=>t&&!u(t.grammarType),fR=t=>d(t)?t:e=>e[t];function vR(t){return!!(null==t?void 0:t.scale)}function _R(t){return!!(null==t?void 0:t.field)}function yR(t,e){if(!t)return[];let i=[];return t.scale&&(i=mR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(dR(t,e))}function bR(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function xR(t,e,i,s,n){i&&(uR(i)?e.forEach((e=>{const n=pR(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case RB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case RB.group:case RB.rect:case RB.image:return["width","height","y1"].includes(e);case RB.path:case RB.shape:return["path","customPath"].includes(e);case RB.line:return"defined"===e;case RB.area:return["x1","y1","defined"].includes(e);case RB.rule:return["x1","y1"].includes(e);case RB.symbol:return"size"===e;case RB.polygon:return"points"===e;case RB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vR(l)){const t=gR(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?hb(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(_R(l)){const t=hb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pR(l,s,e.datum,t)}))})))}function SR(t,e,i,s){if(!t)return null;if(uR(t))return pR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vR(h)){const t=gR(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?hb(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(_R(h)){const t=hb(h.field);n[r]=t(e)}else n[r]=pR(h,s,e,i)})),n}class AR{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let kR=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};kR._plotMarks={},kR._marks={},kR._components={},kR._graphicComponents={},kR._transforms={},kR._grammars={},kR._glyphs={},kR._animations={},kR._interactions={},kR._graphics={},kR.registerGlyph=(t,e,i,s,n)=>(kR._glyphs[t]=new AR(e,i,s,n),kR._glyphs[t]),kR.registerAnimationType=(t,e)=>{kR._animations[t]=e},kR.getAnimationType=t=>kR._animations[t],kR.registerInteraction=(t,e)=>{kR._interactions[t]=e},kR.registerGraphic=(t,e)=>{kR._graphics[t]=e},kR.getGraphicType=t=>kR._graphics[t],kR.createGraphic=(t,e)=>{const i=kR._graphics[t];return i?i(e):null};const MR=t=>!!RB[t];function TR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=kR.getGraphicType(e)?kR.createGraphic(e,i):kR.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||rt.getInstance().error(`create ${e} graphic failed!`),n}const wR=t=>{t&&(t[UB]=null,t.release(),t.parent&&t.parent.removeChild(t))},CR=["fillOpacity"],ER=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const PR={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;k(e.width)||!k(e.x1)&&k(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):k(e.x1)||!k(e.width)&&k(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),k(e.height)||!k(e.y1)&&k(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):k(e.y1)||!k(e.height)&&k(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),k(e.length)||!k(e.z1)&&k(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):k(e.z1)||!k(e.length)&&k(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[RB.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=f(i.text)&&!u(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[RB.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return k(e)&&k(i)&&k(s)&&k(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[RB.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const BR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?PR[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(CR.includes(r)?ER(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{CR.includes(t)?ER(n,t,e):n[t]=e[t]}));return n},RR=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),LR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],OR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(LR);function IR(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?OR:LR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>RR(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=DR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function DR(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let FR=class{constructor(t){this.data=null,this.states=[],this.diffState=BB.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));xR(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?BR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[UB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?BR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===BB.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(wR(this.graphicItem),this.graphicItem[UB]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=fR(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(pR(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===BB.unChange&&(this.diffState=BB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||this.useStates(this.states),this.mark.markType===RB.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new hl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[PB.update],a=e[PB.enter],o=e[PB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===BB.enter?(a&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.update?((n&&a||i)&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.exit&&o&&(i&&xR(this,t,a,s,l),xR(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=c(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)pb(s,i,t)&&O(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[RB.line,RB.area,RB.largeRects,RB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||bR(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[PB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=DR(h),e===RB.line||e===RB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>bR(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===RB.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=IR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=DR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?IR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=SR(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=IR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===RB.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===RB.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!B(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(wR(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class jR{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const zR=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class HR extends jR{constructor(t,e){super(t,e),this.type=HR.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},HR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}HR.type="element-select",HR.defaultOptions={state:WB.selected,trigger:"click"};class VR extends jR{constructor(t,e){super(t,e),this.type=VR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},VR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function NR(t){if(t)return t.type===Pw.Band?t.bandwidth():t.type===Pw.Point?t.step():void 0}VR.type="element-highlight",VR.defaultOptions={highlightState:WB.highlight,blurState:WB.blur,trigger:"pointerover",triggerOff:"pointerout"};class GR{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const WR=()=>{U(HR,GR),kR.registerInteraction(HR.type,HR)},UR=()=>{U(VR,GR),kR.registerInteraction(VR.type,VR)},YR=(t,e)=>mR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,KR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=YR(n,e),i}),{}):t.map((t=>YR(t,e))):t;let XR=-1;class $R extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++XR}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(dR(this.spec[e],this.view)),this.spec[e]=t,this.attach(dR(t,this.view)),this.commit(),this}}const qR=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=dR(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},ZR=(t,e)=>{const i=kR.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(cR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>qR(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return qR(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},JR=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=ZR(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},QR={csv:Ur,dsv:Wr,tsv:Yr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class tL extends $R{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!QR[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return QR[e.type](t,i,new _a(new fa))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?dR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=dR(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=dR(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=mR(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=JR(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const eL="window",iL="view",sL={trap:!1},nL="width",rL="height",aL="viewWidth",oL="viewHeight",lL="padding",hL="viewBox",cL="autoFit";function dL(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function uL(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,dL(t,e,n,s)}class pL{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}return this.nodes.push(t),dL(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,uL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class gL{constructor(t){this.list=[],this.ids={},this.idFunc=t||cb}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class mL{constructor(){this.grammars=[],this.logger=rt.getInstance(),this._curRank=0,this._committed=new gL((t=>t.uid)),this._heap=new pL(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new gL((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const fL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===RB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class vL{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Xd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ol.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new Z_(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new Xb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new Zb(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function _L(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function yL(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return k(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),k(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&k(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&k(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function bL(t,e,i,s,n){if(n===eL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yL(t,_L(t),!1)}))}));const e=_L(t);yL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class xL extends $R{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?pR(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},ML=(t,e)=>e&&e.debounce?bt(t,e.debounce):e&&e.throttle?xt(t,e.throttle):t;class TL extends FR{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return xR(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[UB]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?BR(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=c(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===BB.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.diffState===BB.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=BR(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=PR[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===RB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return YB.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)pb(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[UB]=null})),this.glyphGraphicItems=null),super.release()}}const wL=t=>t.markType===RB.glyph?new TL(t):new FR(t);function CL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(XB,i?t.slice().sort(i):t.slice()),{keys:qB,data:s};const n=fR(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class EL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const PL=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=bR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{u(i[t])&&delete i[t]}));const n=bR(s,e.mark.markType)&&!p(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const BL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class RL extends gc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class LL extends gc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Dd,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):u(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:xo.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:xo.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}fc.mode|=Ao.SET_ATTR_IMMEDIATELY;let OL=0;const IL=t=>!u(t)&&(t.prototype instanceof gc||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class DL{constructor(t,e,i){this.id=OL++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),k(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=d(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!kR.getAnimationType(e.type))return null;const r=kR.getAnimationType(e.type)(t,n,i);return PL(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return y(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):g(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!u(null===(r=n[i])||void 0===r?void 0:r.from),l=!u(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?BL(t,0,n[i].from,0,s):void 0,e.to[i]=l?BL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),PL(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=IL(o);return u(o)||IL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new LL(r.from,r.to,a,t.easing):void 0:new RL(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!u(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new Wc(a,e))}r>0&&t.wait(r)}}function FL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(jL(i,t[i]))})),e}function jL(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Y(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,p;if(u(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:iR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:oR,loop:null!==(s=h.loop)&&void 0!==s?s:aR,controlOptions:z({},hR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sR,delay:null!==(a=h.delay)&&void 0!==a?a:nR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:rR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:lR,customParameters:h.customParameters,options:h.options}]}]}}const g=Y(t.timeSlices).filter((t=>t.effects&&Y(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:iR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:oR,loop:null!==(d=t.loop)&&void 0!==d?d:aR,controlOptions:z({},hR,null!==(p=t.controlOptions)&&void 0!==p?p:{}),timeSlices:g.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:nR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:rR,effects:Y(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:lR,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function zL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class HL{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!u(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class VL{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=FL(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=FL(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==BB.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new HL(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=jL(eR,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new HL(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return u(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=Y(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===BB.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){u(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new DL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===BB.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=pR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=zL(t.startTime,e,n),o=zL(t.totalTime,e,n),l=zL(t.oneByOne,e,n),h=zL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=zL(t.delay,e,n),l=zL(t.delayAfter,e,n),h=null!==(i=zL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:zL(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=S(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:S(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===BB.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===BB.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===eR,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===BB.exit&&0===o[BB.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class NL extends $R{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new VL(this,{}),this.differ=new EL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===BB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===VB.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:$B,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===RB.group)return;const e=CL(null!=t?t:$B,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(BB.update,t,e,i)}encodeState(t,e,i,s){if(t===BB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(uR(n))this.detach(yR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(yR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(yR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(yR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(yR(i,this.view))):uR(e)?(this.spec.encode[t]=e,this.attach(yR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(yR(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=JR(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return YB.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==BB.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===GB.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!uR(n)&&Object.keys(n).forEach((t=>{vR(n[t])&&(e[t]=gR(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];uR(s)||Object.keys(s).forEach((t=>{_R(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[UB];if((null==s?void 0:s.mark)===this){const i=bL(this.view,t,s,0,iL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new VL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gR(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==RB.group){if(!this.graphicItem){const t=TR(this,RB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||KB.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==RB.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=fR(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>XB),a=fR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>XB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===BB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=BB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):wL(this),n.diffState===BB.exit&&(n.diffState=BB.enter,this.animate.getElementAnimators(n,BB.exit).forEach((t=>t.stop("start")))),n.diffState=BB.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=BB.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:$B;l||this.differ.setCurrentData(CL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=SR(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[PB.group],s);e.forEach((t=>{this.markType===RB.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:TR(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==RB.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=fR(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>XB),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=wL(this);e.diffState=BB.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=wL(this);i.diffState=BB.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==RB.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=TR(this,RB.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==BB.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:PR[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=BB.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&wR(this.graphicItem),this.detachAll(),super.release()}}let GL=class extends NL{constructor(t,e){super(t,RB.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===RB.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return PR.rect}evaluateJoin(t){if(!this.elements.length){const t=wL(this);t.updateData(XB,$B,(()=>""),this.view),this.elements=[t],this.elementMap.set(XB,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return xR(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[PB.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:TR(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function WL(t,e){if(k(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return k(t)?t*e:0}return 0}function UL(t,e){return Math.min(t<0?t+e:t-1,e)}function YL(t,e,i){let s=UL(t,i),n=UL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=UL(Math.max(0,n-1),i)):n=UL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const KL=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>WL(t,i))),u=l.map((t=>WL(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let m=0;const f=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=m;return m+=i+h,s}));f.push(m);let v=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return _.push(v),{rows:f,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=YL(e,i,r),{start:h,end:c}=YL(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Zt).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},XL={[LB.axis]:0,[LB.legend]:1,[LB.slider]:2,[LB.player]:3,[LB.datazoom]:4},$L=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=XL[t.componentType])&&void 0!==s?s:1/0},qL=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=gb(r.maxChildWidth,n.width()),o=gb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=kL(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&d$L(t)-$L(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==RB.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(d(r))r.call(null,t,n,a,e);else if(d(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=qL(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(aL,o),i.updateSignal(oL,l),i.updateSignal(lL,h)}else qL(t,n,a,e);else"grid"===r.display&&KL(t,n,a);ZL(n,e,i)}}))};class JL extends NL{constructor(t,e,i){super(t,RB.glyph,i),this.glyphType=e,this.glyphMeta=kR.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!kR.getGraphicType(RB.glyph))return;const s=kR.createGraphic(RB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(kR.getGraphicType(n[t])){const e=kR.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const QL=Symbol.for("key");class tO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(CL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=CL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=CL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!u(e.morphElementKey)){const i=fR(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i}):u(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(CL(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:QL})),r=CL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:QL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==QL){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=pR(i.animation.delay,n,o,l),d=pR(i.animation.duration,n,o,l),u=pR(i.animation.oneByOne,n,o,l),p=pR(i.animation.splitPath,n,o,l),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Md:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Td)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);xd(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Md:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Td)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>vd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>yd(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:xo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new bd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:xc,null!==(l=i.easing)&&void 0!==l?l:Sc))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:xo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Sd({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:xc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Sc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):xd(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class eO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class iO extends eO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===RB.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===RB.group&&e.includesChild(s,!1)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class sO{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class nO extends NL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=TR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?RB.richtext:RB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}nO.markType=RB.text;const rO={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},aO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},oO=Object.assign({},rO);oO.axis=Object.assign({},oO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.circleAxis=Object.assign({},oO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.grid=Object.assign({},oO.grid,{style:{stroke:"#404349"}}),oO.circleGrid=Object.assign({},oO.circleGrid,{style:{stroke:"#404349"}}),oO.rectLabel=Object.assign({},oO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.lineLabel=Object.assign({},oO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.symbolLabel=Object.assign({},oO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.title=Object.assign({},oO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const lO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:aO,components:oO},hO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:aO,components:rO};let cO=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};cO._themes=new Map,cO.registerTheme("default",hO),cO.registerTheme("dark",lO);class dO extends NL{constructor(t,e,i,s){super(t,RB.component,i),this._componentDatum={[XB]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:kR.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,XB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[XB]+=1}evaluateJoin(t){return this.spec.key=XB,t?(t[XB]=this._componentDatum[XB],this._componentDatum=t):this._componentDatum={[XB]:this._componentDatum[XB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uO extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=bt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[UB],n=bL(0,t,s,0,iL);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(mR(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):MR(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new xL(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new tL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kR.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case RB.group:n=new GL(this,s);break;case RB.glyph:n=new JL(this,null==i?void 0:i.glyphType,s);break;case RB.component:n=kR.hasComponent(null==i?void 0:i.componentType)?kR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new dO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case RB.text:n=new nO(this,t,s);break;default:n=kR.hasMark(t)?kR.createMark(t,this,s):new NL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(RB.group,t)}glyph(t,e){return this.mark(RB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(RB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.grid,mode:e})}legend(t){return this.mark(RB.component,t,{componentType:LB.legend})}slider(t){return this.mark(RB.component,t,{componentType:LB.slider})}label(t){return this.mark(RB.component,t,{componentType:LB.label})}datazoom(t){return this.mark(RB.component,t,{componentType:LB.datazoom})}player(t){return this.mark(RB.component,t,{componentType:LB.player})}title(t){return this.mark(RB.component,t,{componentType:LB.title})}scrollbar(t){return this.mark(RB.component,t,{componentType:LB.scrollbar})}customized(t,e){const i=kR.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&AL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(wR(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++SL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(cO.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(nL,t.width),this.updateSignal(rL,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=kR.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=VB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:nL,value:null!==(s=t[nL])&&void 0!==s?s:0},{id:rL,value:null!==(n=t[rL])&&void 0!==n?n:0},{id:lL,value:kL(null!==(a=null!==(r=t[lL])&&void 0!==r?r:e[lL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:aL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[nL]-i.left-i.right},dependency:[nL,lL]}},{id:oL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[rL]-i.top-i.bottom},dependency:[rL,lL]}},{id:hL,update:{callback:(t,e)=>{const i=kL(e[lL]);return(t||new Zt).setValue(i.left,i.top,i.left+e[aL],i.top+e[oL])},dependency:[aL,oL,lL]}},{id:cL,value:null!==(o=t[cL])&&void 0!==o?o:e[cL]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===RB.glyph?{glyphType:t.glyphType}:t.type===RB.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=cO.getTheme(t))&&void 0!==e?e:cO.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(nL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(rL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(aL);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(oL);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(lL);if(arguments.length){const i=kL(t);return this.updateSignal(e,i),i}return kL(e.output())}autoFit(t){const e=this.getSignalById(cL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(hL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=VB.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===RB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZL;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{fL(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),fL(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=ZB,morph:o=JB,morphAll:l=QB,animation:h={},enableExitAnimation:c=tR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:lR,delay:null!==(i=h.delay)&&void 0!==i?i:nR,duration:null!==(s=h.duration)&&void 0!==s?s:sR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:oR,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=VB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=VB.reevaluate,this._dataflow.evaluate()),this._layoutState=VB.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!AL.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return fL(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ei(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(nL,t)),e!==this.height()&&(s=!0,this.updateSignal(rL,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iL;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):MR(t)?(i.markType=t,i.source=e):i.source=t===eL?eL:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,p=u((y=h).markId)?t=>t&&t.mark.id()===y.markId:u(y.markName)?t=>t&&t.mark.name()===y.markName:u(y.type)?t=>t&&t.mark.markType===y.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:_(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),f=cR(l,this),v=ML(((t,e)=>{const s=c===iL&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===eL&&(t=bL(0,t,e,0,eL));let n=!1;if((!i||i(t))&&(!p||p(e))&&m.length){const e=f.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var y;if(c===iL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,iL,d))return this.addEventListener(d,v,sL),()=>{this.removeEventListener(d,v)}}else if(c===eL)return E_.addEventListener(d,v),this._eventListeners.push({type:d,source:E_,handler:v}),()=>{E_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===E_&&t.handler===v));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);_(e)?i.type=e:g(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=kR.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new vL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new eO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iO((t=>t.id())),this._options.logger&&rt.setInstance(this._options.logger),this.logger=rt.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new mL,this.animate=new sO(this),this._morph=new tO,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[iL,eL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:cO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&E_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=VB.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==RB.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=E_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&E_.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),kR.unregisterRuntimeTransforms(),rt.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const pO=()=>{fM(),lM(),kR.registerGraphic(RB.path,Vg)},gO=()=>{fM(),uM(),kR.registerGraphic(RB.rect,Mg)},mO=()=>{fM(),aM(),kR.registerGraphic(RB.rule,Sg)},fO=()=>{fM(),_M(),kR.registerGraphic(RB.symbol,yg)},vO=()=>{fM(),bM(),gM(),kR.registerGraphic(RB.text,gp)},_O=()=>{fM(),tM(),kR.registerGraphic(RB.glyph,wg)},yO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.from.min=l,f.to.min=d),k(u)&&(f.from.max=l,f.to.max=u),k(p)&&(f.from.q1=l,f.to.q1=p),k(g)&&(f.from.q3=l,f.to.q3=g),k(m)&&(f.from.median=l,f.to.median=m),f},bO=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!k(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return k(d)&&(f.to.min=l,f.from.min=d),k(u)&&(f.to.max=l,f.from.max=u),k(p)&&(f.to.q1=l,f.from.q1=p),k(g)&&(f.to.q3=l,f.from.q3=g),k(m)&&(f.to.median=l,f.from.median=m),f},xO=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&k(i.center))return i.center;let m,f,v,_,y;if(_b(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return k(m)?m:k(_)&&k(y)?(_+y)/2:k(f)&&k(v)?(f+v)/2:k(v)?v:k(f)?f:NaN},SO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&_b(s.direction)?(k(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),k(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(k(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),k(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},AO=yO(xO),kO=bO(xO);const MO=(t,e,i)=>{var s,n,r,a;if(k(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(_b(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return k(o)?o:k(c)&&k(d)?(c+d)/2:k(l)&&k(h)?(l+h)/2:k(h)?h:k(l)?l:NaN},TO=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&_b(s.direction)?(k(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),k(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(k(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),k(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},wO=yO(MO),CO=bO(MO);const EO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},PO=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},BO=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?PO:EO,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},RO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},LO=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},OO=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class IO extends dO{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const DO=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class FO extends IO{constructor(t,e,i){super(t,LB.axis,e),this.spec.componentType=LB.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=kR.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=SR(n,e,i,s);const h=pR(this.spec.inside,s,e,i),c=pR(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(DO(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=pR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case IB.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case IB.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?IB.circleAxis:IB.lineAxis,this._axisComponentType}}FO.componentType=LB.axis;let jO=class extends dO{constructor(t,e){super(t,LB.label,e),this.spec.componentType=LB.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=pR(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=pR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case RB.line:case RB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case RB.rect:case RB.rect3d:case RB.interval:g=p.rectLabel;break;case RB.symbol:case RB.circle:case RB.cell:g=p.symbolLabel;break;case RB.arc:case RB.arc3d:g=p.arcLabel;break;case RB.polygon:case RB.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};m&&m.length>0?m.forEach(((e,s)=>{if(t.elements[s]){const n=SR(i,e,t.elements[s],d);z(e,f,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=SR(i,t,e,d);m.push(z({},f,s))}));else{const t=SR(i,e.getDatum(),e,d),s=z({},f,t);m.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return z({},g,{data:m,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!u(t)));return z({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};jO.componentType=LB.label;const zO=()=>{kR.registerGraphicComponent(LB.label,(t=>new $T(t))),kR.registerComponent(LB.label,jO)};class HO extends IO{constructor(t,e,i){super(t,LB.grid,e),this.spec.componentType=LB.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=kR.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=SR(s,t,e,i);const d=pR(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case DB.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case DB.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=pR(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(DO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===DB.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=pR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case DB.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case DB.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=DB.circleAxisGrid:this._gridComponentType=DB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case IB.circleAxis:this._gridComponentType=DB.circleAxisGrid;break;case IB.lineAxis:default:this._gridComponentType=DB.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?DB.lineAxisGrid:DB.circleAxisGrid:DB.lineAxisGrid}else this._gridComponentType=DB.lineAxisGrid;return this._gridComponentType}}HO.componentType=LB.grid;const VO=(t,e,i)=>e.filter((e=>t.callback(e,i))),NO=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function GO(t){return t.reduce(((t,e)=>t+e),0)}const WO={min:$,max:X,average:function(t){return 0===t.length?0:GO(t)/t.length},sum:GO};function UO(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function YO(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function KO(t,e,i,s){return YO(t,e,i,"min",s)}function XO(t,e,i,s){return YO(t,e,i,"max",s)}function $O(t,e,i,s){return YO(t,e,i,"average",s)}function qO(t,e,i,s){return YO(t,e,i,"sum",s)}const ZO=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=UO;if("min"===n?l=KO:"max"===n?l=XO:"average"===n?l=$O:"sum"===n&&(l=qO),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},JO="_mo_hide_";const QO=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(JO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(JO,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(JO,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},tI=()=>{kR.registerTransform("filter",{transform:VO,markPhase:"beforeJoin"},!0)},eI=()=>{kR.registerTransform("map",{transform:NO,markPhase:"beforeJoin"},!0)},iI=()=>{kR.registerTransform("sampling",{transform:ZO,markPhase:"afterEncode"},!0)},sI=()=>{kR.registerTransform("markoverlap",{transform:QO,markPhase:"afterEncode"},!0)},nI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},rI=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},aI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},oI=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},lI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},hI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const cI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const dI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const uI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const pI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},gI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalGraphicAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalGraphicAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},mI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalGraphicAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},fI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalGraphicAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalGraphicAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},vI=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalGraphicAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},_I=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((()=>Object.assign(n)))},yI=(t,e,i)=>({from:{points:_I(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),bI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_I(t,e)}}),xI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),SI=(t,e,i)=>({from:{points:xI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e,i)}}),kI=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}})),MI=(t,e,i)=>({from:{points:kI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),TI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:kI(t,e,i)}}),wI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),c=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&k(u.x)?u.x:h,g=u&&k(u.y)?u.y:c,m=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==m?void 0:m.x}};case"y":return{from:{y:g},to:{y:null==m?void 0:m.y}};default:return{from:{x:p,y:g},to:{x:null==m?void 0:m.x,y:null==m?void 0:m.y}}}},CI=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,u=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,p=("negative"===a?c:0)+r,g=("negative"===a?u:0)+r,m=d(l)?l.call(null,t.getDatum(),t,i):l,f=m&&k(m.x)?m.x:p,v=m&&k(m.y)?m.y:g;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:v}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:v}}}},EI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},PI=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},BI={symbol:["_mo_hide_","visible"]},RI=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&Y(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=BI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{pb(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{u(n[t])&&(u(a[t])||G(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},LI=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=ut(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},OI=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=ut(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},II=()=>{kR.registerAnimationType("clipIn",nI)},DI=()=>{kR.registerAnimationType("clipOut",rI)},FI=()=>{kR.registerAnimationType("fadeIn",aI)},jI=()=>{kR.registerAnimationType("fadeOut",oI)},zI=()=>{kR.registerAnimationType("growCenterIn",lI)},HI=()=>{kR.registerAnimationType("growCenterOut",hI)},VI=()=>{kR.registerAnimationType("growHeightIn",uI)},NI=()=>{kR.registerAnimationType("growHeightOut",pI)},GI=()=>{kR.registerAnimationType("growWidthIn",cI)},WI=()=>{kR.registerAnimationType("growWidthOut",dI)},UI=()=>{kR.registerAnimationType("growPointsIn",yI)},YI=()=>{kR.registerAnimationType("growPointsOut",bI)},KI=()=>{kR.registerAnimationType("growPointsXIn",SI)},XI=()=>{kR.registerAnimationType("growPointsXOut",AI)},$I=()=>{kR.registerAnimationType("growPointsYIn",MI)},qI=()=>{kR.registerAnimationType("growPointsYOut",TI)},ZI=()=>{kR.registerAnimationType("growAngleIn",gI)},JI=()=>{kR.registerAnimationType("growAngleOut",mI)},QI=()=>{kR.registerAnimationType("growRadiusIn",fI)},tD=()=>{kR.registerAnimationType("growRadiusOut",vI)},eD=()=>{kR.registerAnimationType("moveIn",wI)},iD=()=>{kR.registerAnimationType("moveOut",CI)},sD=()=>{kR.registerAnimationType("scaleIn",EI)},nD=()=>{kR.registerAnimationType("scaleOut",PI)},rD=()=>{kR.registerAnimationType("rotateIn",LI)},aD=()=>{kR.registerAnimationType("rotateOut",OI)},oD=()=>{kR.registerAnimationType("update",RI)};class lD extends NL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=uR(e)?null:Object.keys(e).reduce(((t,s)=>(vR(e[s])&&(t[s]=gR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=SR(e,t,i,n);if(u(r.size)){const t=s.x?NR(s.x):void 0,e=s.y?NR(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(PR.symbol)}release(){super.release(),this._encoders=null}}lD.markType=RB.cell;const hD=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var cD,dD,uD;t.ChartEvent=void 0,(cD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",cD.rendered="rendered",cD.renderFinished="renderFinished",cD.animationFinished="animationFinished",cD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",cD.afterInitData="afterInitData",cD.afterInitEvent="afterInitEvent",cD.afterInitMark="afterInitMark",cD.rawDataUpdate="rawDataUpdate",cD.viewDataFilterOver="viewDataFilterOver",cD.viewDataUpdate="viewDataUpdate",cD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",cD.markDeltaYUpdate="markDeltaYUpdate",cD.viewDataLabelUpdate="viewDataLabelUpdate",cD.scaleDomainUpdate="scaleDomainUpdate",cD.scaleUpdate="scaleUpdate",cD.dataZoomChange="dataZoomChange",cD.drill="drill",cD.layoutStart="layoutStart",cD.layoutEnd="layoutEnd",cD.layoutRectUpdate="layoutRectUpdate",cD.playerPlay="playerPlay",cD.playerPause="playerPause",cD.playerEnd="playerEnd",cD.playerChange="playerChange",cD.playerForward="playerForward",cD.playerBackward="playerBackward",cD.scrollBarChange="scrollBarChange",cD.brushStart="brushStart",cD.brushChange="brushChange",cD.brushEnd="brushEnd",cD.brushClear="brushClear",cD.legendSelectedDataChange="legendSelectedDataChange",cD.legendFilter="legendFilter",cD.legendItemClick="legendItemClick",cD.legendItemHover="legendItemHover",cD.legendItemUnHover="legendItemUnHover",cD.tooltipShow="tooltipShow",cD.tooltipHide="tooltipHide",cD.tooltipRelease="tooltipRelease",cD.afterResize="afterResize",cD.afterRender="afterRender",cD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(dD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",dD.window="window",dD.canvas="canvas",t.Event_Bubble_Level=void 0,(uD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",uD.chart="chart",uD.model="model",uD.mark="mark";const pD=`${hB}_waterfall_default_seriesField`,gD=`${hB}_CORRELATION_X`,mD=`${hB}_CORRELATION_Y`,fD=`${hB}_CORRELATION_SIZE`,vD=`${hB}_MEASURE_CANVAS_ID`,_D=`${hB}_DEFAULT_DATA_INDEX`,yD=`${hB}_DEFAULT_DATA_KEY`,bD=`${hB}_DEFAULT_DATA_SERIES_FIELD`,xD=`${hB}_DEFAULT_SERIES_STYLE_NAME`;var SD;t.AttributeLevel=void 0,(SD=t.AttributeLevel||(t.AttributeLevel={}))[SD.Default=0]="Default",SD[SD.Theme=1]="Theme",SD[SD.Chart=2]="Chart",SD[SD.Base_Series=3]="Base_Series",SD[SD.Series=4]="Series",SD[SD.Mark=5]="Mark",SD[SD.User_Chart=6]="User_Chart",SD[SD.User_Series=7]="User_Series",SD[SD.User_Mark=8]="User_Mark",SD[SD.Built_In=99]="Built_In";const AD=`${hB}_STACK_KEY`,kD=`${hB}_STACK_START`,MD=`${hB}_STACK_END`,TD=`${hB}_STACK_START_PERCENT`,wD=`${hB}_STACK_END_PERCENT`,CD=`${hB}_STACK_START_OffsetSilhouette`,ED=`${hB}_STACK_END_OffsetSilhouette`,PD=`${hB}_STACK_TOTAL`,BD=`${hB}_STACK_TOTAL_PERCENT`,RD=`${hB}_STACK_TOTAL_TOP`,LD=`${hB}_SEGMENT_START`,OD=`${hB}_SEGMENT_END`;var ID,DD;t.LayoutZIndex=void 0,(ID=t.LayoutZIndex||(t.LayoutZIndex={}))[ID.Axis_Grid=50]="Axis_Grid",ID[ID.CrossHair_Grid=100]="CrossHair_Grid",ID[ID.Region=450]="Region",ID[ID.Mark=300]="Mark",ID[ID.Node=400]="Node",ID[ID.Axis=100]="Axis",ID[ID.MarkLine=500]="MarkLine",ID[ID.MarkArea=100]="MarkArea",ID[ID.MarkPoint=500]="MarkPoint",ID[ID.DataZoom=500]="DataZoom",ID[ID.ScrollBar=500]="ScrollBar",ID[ID.Player=500]="Player",ID[ID.Legend=500]="Legend",ID[ID.CrossHair=500]="CrossHair",ID[ID.Indicator=500]="Indicator",ID[ID.Title=500]="Title",ID[ID.Label=500]="Label",ID[ID.Brush=500]="Brush",ID[ID.CustomMark=500]="CustomMark",ID[ID.Interaction=700]="Interaction",t.LayoutLevel=void 0,(DD=t.LayoutLevel||(t.LayoutLevel={}))[DD.Indicator=10]="Indicator",DD[DD.Region=20]="Region",DD[DD.Axis=30]="Axis",DD[DD.DataZoom=40]="DataZoom",DD[DD.Player=40]="Player",DD[DD.ScrollBar=40]="ScrollBar",DD[DD.Legend=50]="Legend",DD[DD.Title=70]="Title",DD[DD.CustomMark=70]="CustomMark";const FD=["linear","radial","conical"],jD={x0:0,y0:0,x1:1,y1:1},zD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},HD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},VD={linear:jD,radial:zD,conical:HD},ND={label:{name:"label",type:"text"}},GD=`${hB}_rect_x`,WD=`${hB}_rect_x1`,UD=`${hB}_rect_y`,YD=`${hB}_rect_y1`,KD=Object.assign(Object.assign({},ND),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),XD=Object.assign(Object.assign({},ND),{bar3d:{name:"bar3d",type:"rect3d"}}),$D={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qD=Object.assign(Object.assign({},ND),$D),ZD=Object.assign(Object.assign({},ND),{point:{name:"point",type:"symbol"}}),JD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),QD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),tF=Object.assign(Object.assign({},ND),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),eF=Object.assign(Object.assign({},ND),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),iF=Object.assign(Object.assign({},ND),{rose:{name:"rose",type:"arc"}}),sF=Object.assign(Object.assign({},ND),{area:{name:"area",type:"path"}}),nF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"}}),rF=Object.assign(Object.assign({},nF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),aF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),oF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),lF=Object.assign(Object.assign({},ND),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),hF=Object.assign(Object.assign({},ND),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),cF=Object.assign(Object.assign({},ND),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),dF=Object.assign(Object.assign({},ND),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),uF=Object.assign(Object.assign({},KD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pF=Object.assign(Object.assign({},ND),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),gF=Object.assign(Object.assign({},ND),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mF=Object.assign(Object.assign({},ND),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),fF=Object.assign(Object.assign({},nF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),vF=Object.assign(Object.assign({},ND),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),_F=Object.assign(Object.assign({},ND),{sunburst:{name:"sunburst",type:"arc"}}),yF=Object.assign(Object.assign({},KD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),bF=Object.assign(Object.assign({},XD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),xF=Object.assign(Object.assign({},ND),{circlePacking:{name:"circlePacking",type:"arc"}}),SF=Object.assign(Object.assign({},ND),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),AF=Object.assign(Object.assign({},ND),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),kF=Object.assign({},JD),MF=Object.assign(Object.assign({},ND),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),TF=Object.assign(Object.assign({},ND),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var wF;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(wF||(wF={}));const CF={[oB.bar]:KD,[oB.bar3d]:XD,[oB.line]:qD,[oB.scatter]:ZD,[oB.area]:JD,[oB.radar]:QD,[oB.pie]:tF,[oB.pie3d]:eF,[oB.rose]:iF,[oB.geo]:ND,[oB.map]:sF,[oB.circularProgress]:rF,[oB.link]:aF,[oB.dot]:oF,[oB.wordCloud]:lF,[oB.wordCloud3d]:lF,[oB.funnel]:hF,[oB.funnel3d]:cF,[oB.linearProgress]:dF,[oB.waterfall]:uF,[oB.boxPlot]:pF,[oB.treemap]:gF,[oB.sankey]:mF,[oB.gauge]:fF,[oB.gaugePointer]:vF,[oB.sunburst]:_F,[oB.rangeColumn]:yF,[oB.rangeColumn3d]:bF,[oB.circlePacking]:xF,[oB.heatmap]:SF,[oB.correlation]:AF,[oB.rangeArea]:kF,[oB.liquid]:MF,[oB.venn]:TF};function EF(t){var e,i;const{type:s}=t;return s===oB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const PF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},BF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function RF(t,e){var i;if(!t)return[];const s=zF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?FF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>DF(i)?OF(t,i,e):i)).filter(p)}))):i.map((i=>DF(i)?OF(t,i,e):i)).filter(p):[]}return[]}function LF(t,e){var i,s;return FF(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function OF(t,e,i){var s;const n=zF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=PF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=BF[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new ve(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=he(t,i,s),a=le(n,r,e.l),l=new ve(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const IF=(t,e,i)=>{if(e&&DF(t)){const s=OF(e,t,i);if(s)return s}return t};function DF(t){return t&&"palette"===t.type&&!!t.key}function FF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jF(t){return y(t)?{dataScheme:t}:t}function zF(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=EF(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class HF extends sC{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!FF(this._range))return void super.range(this._range);const t=LF(this._range,this._domain);super.range(t)}}const VF={linear:TC,band:rC,point:class extends rC{constructor(t){super(!1),this.type=Pw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sC,threshold:BC,colorOrdinal:HF};function NF(t){const e=VF[t];return e?new e:null}function GF(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function WF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function UF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function YF(t){return!!_(t)&&(!!t.endsWith("%")&&sb(t.substring(0,t.length-1)))}function KF(t,e,i,s=0){var n,r;return S(t)?t:YF(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function XF(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=KF(t[s],e.size,i)}))})),o}function $F(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||YF(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function qF(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZF=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},JF=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],QF={default:{dataScheme:JF,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)"}}},tj="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",ej={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:tj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:tj,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:CB,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},ij={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},sj=Object.assign(Object.assign({},ij),{label:{space:0}}),nj={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},rj="M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",aj={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},oj={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},lj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},hj={horizontal:Object.assign(Object.assign({},oj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj}),vertical:Object.assign(Object.assign({},oj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj})},cj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},dj={horizontal:Object.assign(Object.assign({},oj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:cj}),vertical:Object.assign(Object.assign({},oj),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:cj})},uj={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},pj={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},gj={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function mj(t,e){return t&&e.key in t?t[e.key]:e.default}function fj(t){return t&&"token"===t.type&&!!t.key}const vj={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},_j={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:QF,token:vj,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:ej,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:hj,sizeLegend:dj,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:ij,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:sj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:pj,markArea:uj,markPoint:gj,polarMarkLine:pj,polarMarkArea:uj,polarMarkPoint:gj,geoMarkPoint:gj,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:aj,crosshair:nj,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},yj={name:"dark",colorScheme:{default:{dataScheme:JF,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},bj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>bj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>bj(t[i],e[i])))),xj=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),xj(t[s],e.slice(1),i))};function Sj(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof _a||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=y(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||_(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=Sj(n,e)}return s}function Aj(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!y(t[r])?kj(t,e,r,i):Mj(t,r,s[r])}}}}function kj(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(y(r)){if(s)a=[];else if(y(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Tj({},t[n][e.index],i):i):t[n]=s?Tj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Tj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Tj({},t[n],i):i)}))}function Cj(t,...e){return Tj(Ej(t),...e.map(Ej))}function Ej(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=jF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(CF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Pj(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function Pj(t,e,i,s){if(!CF[e])return t;const n={};return Object.values(CF[e]).forEach((({type:e,name:r})=>{n[r]=Tj({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const Bj=["animationThreshold","colorScheme","name","padding"];function Rj(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];Bj.includes(r)?n[r]=a:f(a)?DF(a)?n[r]=IF(a,e,s):fj(a)?n[r]=mj(i,a):n[r]=Rj(a,e,i,s):n[r]=a})),n}const Lj={[_j.name]:_j},Oj=_j.name,Ij=new Map(Object.keys(Lj).map((t=>[t,Lj[t]]))),Dj=new Map(Object.keys(Lj).map((t=>[t,Rj(Lj[t])]))),Fj=new Map(Object.keys(Lj).map((t=>[t,t===Oj]))),jj=(t,e)=>{if(!t)return;const i=Nj(e);Ij.set(t,i),Dj.set(t,Rj(i)),Fj.set(t,!0)},zj=(t=Oj,e=!1)=>(Fj.has(t)&&!Fj.get(t)&&jj(t,Ij.get(t)),e?Dj.get(t):Ij.get(t)),Hj=t=>Ij.delete(t)&&Dj.delete(t)&&Fj.delete(t),Vj=t=>!!_(t)&&Ij.has(t),Nj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Oj;return Cj({},zj(i),t)};class Gj{static registerInstance(t){Gj.instances.set(t.id,t)}static unregisterInstance(t){Gj.instances.delete(t.id)}static getInstance(t){return Gj.instances.get(t)}static instanceExist(t){return Gj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Gj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Gj.instances=new Map;class Wj{static registerTheme(t,e){jj(t,e)}static getTheme(t,e=!1){return zj(t,e)}static removeTheme(t){return Hj(t)}static themeExist(t){return Vj(t)}static getDefaultTheme(){return Wj.themes.get(Oj)}static setCurrentTheme(t){Wj.themeExist(t)&&(Wj._currentThemeName=t,Gj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Wj.getTheme(Wj._currentThemeName,t)}static getCurrentThemeName(){return Wj._currentThemeName}}function Uj(t,e){return _(t)?Wj.themeExist(t)?Wj.getTheme(t,e):{}:g(t)?t:{}}function Yj(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=Yj(t[s],e)}return i}return y(t)?t.map((t=>Yj(t,e))):t}function Kj(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=Kj(t[s],e)}return i}return y(t)?t.map((t=>Kj(t,e))):t}Wj.themes=Ij,Wj._currentThemeName=Oj;function Xj(t,e){for(let i=0;it.key===e))}function qj(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function Zj(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},iz(t,a,n[o],l,e,r))})),s?Jj(n):n}function Jj(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):Jj(t[e].nodes);return t}function Qj(t,e){if("values"in t&&t.values.length){const i=JP(t.values,e),s=ZP(t.values,wD);t.values.forEach((t=>{t[PD]=i,t[BD]=s,delete t[RD]}));const n=t.values.reduce(((t,e)=>e[MD]>t[MD]?e:t));n[RD]=!0}else for(const i in t.nodes)Qj(t.nodes[i],e)}function tz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MD]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[kD]=s,s+=r[MD],r[MD]=s):(r[kD]=n,n+=r[MD],r[MD]=n),r[AD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[TD]=0===h?0:Math.min(1,l[kD]/h)*r,l[wD]=0===h?0:Math.min(1,l[MD]/h)*r}}for(const s in t.nodes)ez(t.nodes[s],e,i)}function iz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[MD]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),iz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const sz=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=rz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function az(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>lz(t.style(e,i,s,n)):B(t.style)||(e.style=lz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>lz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=lz(t.state[e]))})),e.state=i}return e}function oz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e,s,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}function lz(t){return(null==t?void 0:t.angle)&&(t.angle=Qt(t.angle)),t}class hz{static registerChart(t,e){hz._charts[t]=e}static registerSeries(t,e){hz._series[t]=e}static registerComponent(t,e,i){hz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){hz._marks[t]=e}static registerRegion(t,e){hz._regions[t]=e}static registerTransform(t,e){hz.transforms[t]=e}static registerLayout(t,e){hz._layout[t]=e}static registerAnimation(t,e){hz._animations[t]=e}static registerImplement(t,e){hz._implements[t]=e}static registerChartPlugin(t,e){hz._chartPlugin[t]=e}static registerComponentPlugin(t,e){hz._componentPlugin[t]=e}static createChart(t,e,i){if(!hz._charts[t])return null;return new(0,hz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!hz._charts[t])return null;const i=hz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!hz._regions[t])return null;return new(0,hz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!hz._regions[t])return null;return new(0,hz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!hz._series[t])return null;return new(0,hz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!hz._series[t])return null;return new(0,hz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!hz._marks[t])return null;const s=new(0,hz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(hz._components)}static getComponentInKey(t){return hz._components[t].cmp}static getLayout(){return Object.values(hz._layout)}static getLayoutInKey(t){return hz._layout[t]}static getSeries(){return Object.values(hz._series)}static getSeriesInType(t){return hz._series[t]}static getRegionInType(t){return hz._regions[t]}static getAnimationInKey(t){return hz._animations[t]}static getImplementInKey(t){return hz._implements[t]}static getSeriesMarkMap(t){return hz._series[t]?hz._series[t].mark:{}}static getChartPlugins(){return Object.values(hz._chartPlugin)}static getComponentPlugins(){return Object.values(hz._componentPlugin)}static getComponentPluginInType(t){return hz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}hz._charts={},hz._series={},hz._components={},hz._marks={},hz._regions={},hz._animations={},hz._implements={},hz._chartPlugin={},hz._componentPlugin={},hz.transforms={fields:Lr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},hz.dataParser={csv:Ur,dsv:Wr,tsv:Yr},hz._layout={};const cz=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},dz=(t,e,i,s)=>{var n;const r=jw(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:uz(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,pz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},gz=(t,e)=>{if(!t)return null;if(!rB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=pz(t,(t=>"angle"===t.getOrient()),e),r=pz(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&jw(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=eB({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=iB(d),m=null===(e=r[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=dz(v,t,"polar",o);a.push({index:_,value:v,position:n.scale(v),axis:t,data:y})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&jw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=eB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iB(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=r.invert(p);if(u(f))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=dz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function mz(t){return"bottom"===t||"top"===t}function fz(t){return"left"===t||"right"===t}function vz(t){return"z"===t}function _z(t,e){return UF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function yz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function bz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?mz(t)?"linear":"band":mz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const xz=t=>t.fieldX[0],Sz=t=>t.fieldY[0],Az=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Mz=(t,e)=>t?e?xz:Az:e?Sz:kz,Tz=(t,e,i)=>{var s,n;if(!t)return null;if(!rB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=pz(t,(t=>mz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=pz(t,(t=>fz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{jw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=wz(s,i,t,Mz(e,jw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=wz(s,i,t,Mz(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},wz=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return Cz(t,a,s)},Cz=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=dz(e,t,"cartesian",null!=i?i:mz(t.getOrient())?xz:Sz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Ez{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:Xy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:Xy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Tz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=gz(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>jw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return mz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Cz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Pz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Pz||(Pz={}));const Bz={[Pz.dimensionHover]:class extends Ez{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!cz(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),Qy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Qy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Pz.dimensionClick]:class extends Ez{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let Rz=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(Bz[t]){const e=new Bz[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(Bz[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Lz{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Oz={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class Iz{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new Lz);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return Oz[a]&&(a=Oz[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.query||this._filter(a,e,i)){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=xt(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=bt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return hD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kR.hasInteraction(e)}}function Dz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Fz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jz=new Map;let zz;function Hz(){zz||(zz=new fa,Fz(zz,"geojson",ca),Fz(zz,"topojson",ua),Dz(zz,"simplify",Br))}function Vz(t,e,i={type:"geojson",centroid:!0}){jz.has(t)&&Ky(`map type of '${t}' already exists, will be overwritten.`),Hz();const s=new _a(zz),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),jz.set(t,s)}function Nz(t){jz.has(t)?jz.delete(t):Ky(`map type of '${t}' does not exists.`)}function Gz(t,e=!1){let i=e;return t.latestData instanceof _a&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Wz=(t,e)=>0===t.length?[]:1===t.length?Gz(t[0],null==e?void 0:e.deep):t.map((t=>Gz(t,null==e?void 0:e.deep)));function Uz(t,e,i){Dz(e=e instanceof fa?e:t.dataSet,"copyDataView",Wz);const s=new _a(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:Xz.copyDataView}),s}function Yz(t,e,i=[],s={}){var n,r,a;if(t instanceof _a)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?I(t.parser):{clone:!0},p=I(t.fields);let g;u.clone=!(!1===u.clone);const m=i.find((t=>t.name===o));if(m)g=m;else{const t={name:o};if(p&&(t.fields=p),g=new _a(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Xy)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Xy)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!_(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Ky("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function Kz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Xz;!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(Xz||(Xz={}));const $z=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new rt(null!==(t=this._option.logLevel)&&void 0!==t?t:nt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new uO(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:tH(this._option.mode),autoFit:!1,eventConfig:{gesture:Qy(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=E_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(E_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(E_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return Jy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function iH(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:Xy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function sH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Tj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nH(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ei(l,i.width,i.height);a=t,o=e}else if(h&&Jy(e.mode)){let t;t=_(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ei(t,i.width,i.height);a=e,o=s}else if(tb(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function rH(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec")}),t}function aH(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(Jz||(Jz={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Qz||(Qz={}));class oH{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},oH.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}oH.defaultMarkInfo={};class lH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new oH,this._markReverse=new oH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(Jz.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(Jz.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[Jz.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[Jz.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Pz.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const hH={};Object.values(Jz).forEach((t=>{hH[t]=!0}));const cH={[Jz.STATE_HOVER]:Jz.STATE_HOVER_REVERSE,[Jz.STATE_SELECTED]:Jz.STATE_SELECTED_REVERSE,[Jz.STATE_DIMENSION_HOVER]:Jz.STATE_DIMENSION_HOVER_REVERSE};function dH(t){return cH[t]}class uH{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=dH(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=dH(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=dH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=dH(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class pH{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class gH extends pH{constructor(){super(...arguments),this.id=ib(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class mH extends gH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=Zz.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class fH extends pH{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new mH(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class vH extends fH{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class _H extends vH{constructor(){super(...arguments),this.id=ib(),this.stateKeyToSignalName=t=>`${hB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===qz.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===qz.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?qz.none:qz.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?qz.exit:qz.appear}}}}class yH{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>Tj({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class bH extends pH{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=yH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new oH,this._lastLayoutRect=null,this.id=ib(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Rz(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${hB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=hz.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class xH{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=XF($F(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:KF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:KF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:KF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:KF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:KF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:KF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=KF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=KF(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=KF(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class SH extends bH{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new xH(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class AH extends yH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kH extends SH{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var s;super(e,i),this.transformerConstructor=AH,this.modelType="region",this.specKey="region",this.type=kH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new uH,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new _H({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new lH(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in Qz)B(t.stateStyle[Qz[e]])||this.interaction.registerMark(Qz[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function MH(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function TH(t,e,i){e?t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=K(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function wH(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function CH(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),wH(c,!0,u,o),s&&TH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function EH(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),wH(c,!1,u,a),s&&TH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function BH(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"left"),n.length&&CH(n,e,i,!0,"left"),r.length&&EH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"top"),n.length&&PH(n,e,i,!0,"top"),r.length&&BH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"right"),n.length&&CH(n,e,i,!0,"right"),r.length&&EH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"bottom"),n.length&&PH(n,e,i,!0,"bottom"),r.length&&BH(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{t.setLayoutRect({width:s,height:n}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Xy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}RH.type="base";const LH=["line","area","trail"];function OH(t){return LH.includes(t)}class IH extends vH{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(OH)?s:!t.mark||OH(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!hH[t])).map((t=>[t,10])),s=!t.mark||OH(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(hB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(hB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(Dw(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class DH extends gH{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=Zz.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class FH extends DH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${hB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class jH extends gH{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=Zz.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new IH(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new Rz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new FH(t)}stateKeyToSignalName(t){return`${hB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=Jz.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=Jz.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===qz.appear&&this.runAnimationByState(qz.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(qz.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class zH extends jH{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Qt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&Tj(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Fw(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=NF(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Fw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=LF(RF(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},VD[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=ve.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)FD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=LF(RF(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class HH extends zH{constructor(){super(...arguments),this.type=HH.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Ky("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(Ky("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}HH.type="group";const VH=()=>{fM(),iM(),kR.registerGraphic(RB.group,Au),hz.registerMark(HH.type,HH)},NH={type:"clipIn"},GH={type:"fadeIn"};function WH(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return GH;default:return NH}}const UH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},YH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},KH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},XH=()=>{hz.registerAnimation("scaleInOut",(()=>YH))},$H=()=>{hz.registerAnimation("fadeInOut",(()=>KH))},qH=(t,e)=>({appear:WH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:zc,duration:UH.update.duration,easing:UH.update.easing}],disappear:{type:"clipOut"}}),ZH=()=>{hz.registerAnimation("line",qH)},JH=()=>{uO.useRegisters([UI,YI,KI,XI,$I,qI,II,DI])},QH={measureText:(t,e,i,s)=>((t,e,i)=>GM(t,e,i,{fontFamily:vj.fontFamily,fontSize:vj.fontSize}))(e,i,s).measure(t)};class tV{static instance(){return tV.instance_||(tV.instance_=new tV),tV.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class eV{constructor(){this.id=ib(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?Ky("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class iV extends eV{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class sV{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}static getFunction(t){return t?tV.instance().getFunction(t):null}static getFunctionList(){return tV.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jz.get(e);var e}static hideTooltip(t=[]){Gj.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return rt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c;this.id=ib(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=bt(((...t)=>{this._doResize()}),100),this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const d=this._option,{dom:u,renderCanvas:p,mode:g,stage:m,poptip:f}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),y=Jy(g);y&&u&&(this._container=_(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),m&&(this._stage=m),"node"===g||this._container||this._canvas||this._stage?(y?Cx($l):"node"===g&&lA($l),this._viewBox=this._option.viewBox,this._currentThemeName=Wj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==f?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Iz(this,this._compiler),this._event=new Rz(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!y&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Gj.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Tj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Yj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sV.getFunctionList()&&sV.getFunctionList().length&&(t=Kj(t,sV)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=hz.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=hz.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return nH(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:cB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:dB})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof fa?t:new fa,Fz(this._dataSet,"dataview",pa),Fz(this._dataSet,"array",s),Dz(this._dataSet,"stackSplit",$z),Dz(this._dataSet,"copyDataView",Wz);for(const t in hz.transforms)Dz(this._dataSet,t,hz.transforms[t]);for(const t in hz.dataParser)Fz(this._dataSet,t,hz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})))}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Gj.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i){return u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));if(o)o instanceof _a?(o.setFields(I(a)),o.parse(n,I(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const s=Yz(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;G(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),rH(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||wj(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||wj(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=Tj({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),B(s)&&B(n))this._currentTheme=Uj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Cj({},Uj(this._currentThemeName,!0),Uj(s,!0),Uj(n,!0));this._currentTheme=t}else{const t=Cj({},Uj(this._currentThemeName),Uj(s),Uj(n));this._currentTheme=Rj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(eT.poptip,tT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Jy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Uj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield iH(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!Jy(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?null===document||void 0===document?void 0:document.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?qF(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Ky("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?qF(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Ky("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tV.instance().getFunction(t)}registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}getFunctionList(){return tV.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=hz.getChartPlugins();t.length>0&&(this._chartPlugin=new iV(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}sV.InstanceManager=Gj,sV.ThemeManager=Wj,sV.globalConfig={uniqueTooltip:!0},sV.Utils=QH,sV.vglobal=E_;hz.registerRegion("region",kH),hz.registerLayout("base",RH),VH(),uO.useRegisters([tI,eI]),uO.useRegisters([sD,nD,FI,jI,eD,iD,rD,aD,oD]),UR(),WR(),jj(yj.name,yj),rt.getInstance(nt.Error);const nV=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(oB).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=hz.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=hz.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},rV=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=nV(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):bj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Tj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Tj(m,f),hasChanged:!0};const i=Tj({},t,f);xj(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}};class aV{constructor(t){this.id=ib(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const oV=t=>{hz.registerChartPlugin(t.type,t)};class lV extends aV{constructor(){super(lV.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[lV.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[lV.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=Sj(this._option.globalInstance.getSpec(),["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Sj(this._baseChartSpec,["data",lV.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=rV(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=Sj(i,["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}lV.pluginType="chart",lV.specKey="media",lV.type="MediaQueryPlugin";const hV=/\{([^}]+)\}/,cV=/\{([^}]+)\}/g,dV=/:/;class uV extends aV{constructor(){super(uV.type),this.type="formatterPlugin",this._timeModeFormat={utc:ci.getInstance().timeUTCFormat,local:ci.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=_i.getInstance().format,this._numericSpecifier=_i.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[uV.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),hz.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=hV.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(cV,((t,i)=>{if(!dV.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(mi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}uV.pluginType="chart",uV.specKey="formatter",uV.type="formatterPlugin";function pV(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function gV(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function mV(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function fV(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function vV(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function _V(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const yV=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const m=c.domain(),f=m[1]-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return RC(v)};class bV extends aV{constructor(){super(bV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Dw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&pV(c)&&pV(d)))return;const u=gV(t,c),p=gV(e,d),{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===m){if(!fV(u,p))return}else if(0===y&&0===b){if(!fV(p,u))return}else if(_||A)if(_&&!A){if(!mV(u,p))return}else if(A&&!_){if(!mV(p,u))return}else{if(m===b)return;if(m>b){if(!vV(u,p))return}else if(!vV(p,u))return}else{if(0===m&&0===y){if(!_V(u,p))return}else if(0===b&&0===g&&!_V(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){Dz(e.getOption().dataSet,"tickAlign",yV);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}bV.pluginType="component",bV.type="AxisSyncPlugin";const xV=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,SV=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},gm||(gm=um.CreateGraphic("richtext",{})),gm.setAttributes(a),gm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},AV="vchart-tooltip-container",kV={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function MV(t,e){return R(e,`component.${t}`)}function TV(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const wV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function CV(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function EV(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function PV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function BV(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const RV=(t,e,i)=>{var s;const n=null!==(s="band"===e?MV("axisBand",i):["linear","log","symlog"].includes(e)?MV("axisLinear",i):{})&&void 0!==s?s:{},r=mz(t)?MV("axisX",i):fz(t)?MV("axisY",i):MV("axisZ",i);return Tj({},MV("axis",i),n,r)},LV=(t,e,i)=>{var s;const n=null!==(s="band"===e?MV("axisBand",i):"linear"===e?MV("axisLinear",i):{})&&void 0!==s?s:{},r=MV("angle"===t?"axisAngle":"axisRadius",i);return Tj({},MV("axis",i),n,r)},OV=t=>"band"===t||"ordinal"===t||"point"===t;function IV(t,e){return{id:t,label:t,value:e,rawValue:t}}function DV(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function FV(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const jV=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,A;c&&(x=y?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:_,axis:g});let k,M=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(jw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Dw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=FV(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=CV(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(jw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Dw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=FV(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=CV(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(HV(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&zV(t,"top",r.label),e.visible&&zV(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(HV(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&zV(t,"left",a.label),e.visible&&zV(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},zV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=TV(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},HV=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},VV=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=GV(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},NV=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=GV(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},GV=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},WV=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},UV={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},YV=(t,e)=>{var i,s;return null!==(s=null===(i=UV[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},KV=(t,e)=>{var i,s;return null!==(s=null===(i=UV[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},XV=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=jV(3,e,i,s,n,r,a);return o?VV(r,o,d,h):l?NV(a,l,u,c):void 0},$V={fontFamily:vj.fontFamily,spacing:10,wordBreak:"break-word"};function qV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:$V),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const ZV=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r},JV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,QV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),tN=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function eN(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=iN(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),m=h.getLayoutRect(),f=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),_=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>QV(i,s)(t)&&QV(n,r)(t)&&(u(a)||QV([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>_(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:y({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return sV.globalConfig.uniqueTooltip&&sV.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},_(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:y(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return sV.globalConfig.uniqueTooltip&&sV.hideTooltip(u.id),d}return"none"}const iN=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=JV(c,t);let _=JV(d,t);const y=tN(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(QV(c,v));if(!y&&(_=JV(d,i),!tN(_)))return;const n=e.type===oB.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=jw(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(QV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=JV(d,o),!tN(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(QV(c,n));if(!y&&(_=JV(d,r),!tN(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===oB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(QV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=JV(d,i),!tN(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},sN=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const nN=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class rN{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class aN extends rN{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:lN(e.title,{seriesId:this.series.id},!0),content:hN(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=sN(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const oN=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},lN=(t,e,i)=>p(t)?d(t)?(...s)=>oN(t(...s),e,i):oN(t,e,i):void 0,hN=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>oN(t,e,i))):oN(t,e,i))):void 0;return s},cN=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=nN(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=nN(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...Y(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},dN=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?I(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=uN(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&sN(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...Y(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},uN=mt((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),pN=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},gN=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=TV(void 0,s,t,e);i&&r&&(n=i(...r))}return n},fN=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class vN{}vN.dom=`${hB}_TOOLTIP_HANDLER_DOM`,vN.canvas=`${hB}_TOOLTIP_HANDLER_CANVAS`;const _N=20,yN={key:"其他",value:"..."},bN=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=ci.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)},xN=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=fN(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==mN(h,e,i);if(l&&_){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:bN(mN(c,t,i,v),p,g),valueStyle:mN(m,t,i),hasShape:f}}else o.title={hasShape:!1,visible:!1};const y=((t,e,i)=>{if(u(t))return t;let s=[];return Y(t).forEach((t=>{d(t)?s=s.concat(Y(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=_N}=t,x=t.othersLine?Object.assign(Object.assign({},yN),t.othersLine):yN,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=SN(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=SN(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},SN=(t,e,i)=>{const s=bN(mN(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=bN(mN(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==mN(e.visible,t,i)&&(p(s)||p(n)),a=mN(e.isKeyAdaptive,t,i),o=mN(e.spaceRow,t,i),l=mN(e.shapeType,t,i),h=mN(e.shapeColor,t,i),c=mN(e.shapeFill,t,i),d=mN(e.shapeStroke,t,i),u=mN(e.shapeLineWidth,t,i),g=mN(e.shapeHollow,t,i),m=mN(e.keyStyle,t,i),f=mN(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:m,valueStyle:f,spaceRow:o,datum:t}};class AN extends aV{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,m=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],f={x:1/0,y:1/0};let{offsetX:v,offsetY:_}=this._option;if(!u)return this._cacheTooltipPosition=void 0,f;const{activeType:y,data:b}=t,x=u[y],A=fN(x.position,b,e),M=null!==(n=fN(x.positionMode,b,e))&&void 0!==n?n:"mark"===y?"mark":"pointer",T=this._getParentElement(u),{width:w=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:cB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:dB;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(Jy(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==T?void 0:T.getBoundingClientRect())&&void 0!==l?l:f;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=xV(t,e),j=xV(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,V,N,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=XV(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(YV(t)){case"left":H=r-w*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-w*z/2;break;case"centerLeft":H=(r+a)/2-w*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(_=null!=s?s:_,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==m?void 0:m.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=XV(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(KV(t)){case"top":V=r-C*z-_;break;case"bottom":V=a+_;break;case"center":V=(r+a)/2-C*z/2;break;case"centerTop":V=(r+a)/2-C*z-_;break;case"centerBottom":V=(r+a)/2+_}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=WV(t,c),V=WV(i,c),N=WV(e,c),G=WV(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=WV(t,c):Y(t),S(e)||d(e)?V=WV(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(N))$=B-w*z-N;else{const t=Z;switch(YV(W,"right")){case"center":$=t-w*z/2;break;case"left":case"centerLeft":$=t-w*z-v;break;case"right":case"centerRight":$=t+v}}if(k(V))q=V;else if(k(G))q=R-C*z-G;else{const t=J;switch(KV(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-_;break;case"bottom":case"centerBottom":q=t+_}}$*=F,q*=F,Jy(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+w)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===YV(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===YV(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===KV(A,"bottom")?q+=_+C/2:q+=2*_+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===KV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(YV(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(KV(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:w,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,xt(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},kV),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:kV.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:kV.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=ti(d.padding),x=$F(d.padding),S=qV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=qV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=qV(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:ZV(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:w={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;T.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Tj({},A,qV(b,void 0,{})),{width:s,height:n,text:r}=SV(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=Tj({},k,qV(x,void 0,{})),{width:e,height:s,text:n}=SV(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c},e=null!=d?d:T;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:M.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aY.autoWidth&&!1!==Y.multiLine;if(N){Y=Tj({},S,qV(W,void 0,{})),K()&&(Y.multiLine=null===(r=Y.multiLine)||void 0===r||r,Y.maxWidth=null!==(a=Y.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=SV(G,Y);T.title.value=Object.assign(Object.assign({width:K()?Math.min(e,null!==(o=Y.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},Y),{text:t}),z=T.title.value.width,H=T.title.value.height,V=H+(O?T.title.spaceRow:0)}return P+=V,B+=V,T.title.width=z,T.title.height=H,K()?E+=R||z:E+=Math.max(z,R),O&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=P,T.panelDomHeight=B,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(Jy(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=xV(t,s),u=xV(l,c)}return s*=d,n*=d,Jy(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(Ie(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return Ke([c,a,o],r.x,r.y)||Ke([c,l,h],r.x,r.y)||Ke([c,a,h],r.x,r.y)||Ke([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}AN.specKey="tooltip";const kN=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",MN=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let TN;const wN=(t=document.body)=>{if(u(TN)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),TN=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return TN};function CN(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:T=0}=n,{value:w={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=Tj({},e,t),s={};return s.width=kN(i),s}(C),R=EN(E),L=EN(P),{bottom:O,left:I,right:D,top:F}=$F(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:kN(T+2*M),minHeight:kN(g+2*M),paddingBottom:kN(O),paddingLeft:kN(I),paddingRight:kN(D),paddingTop:kN(F),borderColor:k,borderWidth:kN(M),borderRadius:kN(A),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?kN(null==r?void 0:r.spaceRow):"0px"},EN(Tj({},w,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return PN.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=PN.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==Zy?void 0:Zy.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(PN.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}PN.type="tooltipModel";const BN={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},RN={boxSizing:"border-box"},LN={display:"inline-block",verticalAlign:"top"},ON={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},IN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},DN={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},FN={lineHeight:"normal",boxSizing:"border-box"};class jN extends PN{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=MN(u),y=t=>new _g({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class zN extends PN{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const HN={overflowWrap:"normal",wordWrap:"normal"};class VN extends PN{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=et(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=et(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(Tj({},LN,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=Tj({},o?IN:ON,Object.assign(Object.assign(Object.assign({height:kN(l)},HN),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return _(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return Tj({},DN,Object.assign(Object.assign(Object.assign({height:kN(s)},HN),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return Tj({},FN,Object.assign(Object.assign({height:kN(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=_(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class NN extends PN{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new VN(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Tj(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+MN(e)),0);return Object.assign(Object.assign({},t),{width:`${a+wN(this._option.getContainer())}px`,maxHeight:kN(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class GN extends PN{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new jN(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new zN(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Tj({},BN,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const WN="99999999999999";class UN extends PN{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:WN,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new GN(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new NN(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Tj({},RN,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const YN=t=>{hz.registerComponentPlugin(t.type,t)};class KN extends AN{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(KN.type),this.type=vN.dom,this._tooltipContainer=null==Zy?void 0:Zy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Zy&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=CN(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!ii(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}KN.type=vN.dom;class XN extends AN{constructor(){super(XN.type),this.type=vN.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new XP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}XN.type=vN.canvas;const $N=()=>{YN(XN)},qN=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},ZN={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},JN=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=Xj([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return QN(a,n,o)},QN=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{sb(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{sb(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=ZN[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},tG=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{sb(t[e])||(t[e]=0)}))})),t};class eG extends DH{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const iG=`${hB}_HIERARCHY_DEPTH`,sG=`${hB}_HIERARCHY_ROOT`,nG=`${hB}_HIERARCHY_ROOT_INDEX`;function rG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function aG(t,e,i){t&&(i.needDefaultSeriesField&&(t[bD]=i.defaultSeriesField),t[_D]=e,t[yD]=i.getKey(t,e,i))}function oG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function lG(t,e,i,s=0,n,r){void 0===r&&(r=e),aG(t,e,i),t[iG]=s,t[sG]=n||t[i.categoryField],t[nG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>lG(e,s,i,t[iG]+1,t[sG],r)))}const hG=["appear","enter","update","exit","disappear","normal"];function cG(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return mG(n)&&delete n.type,n.oneByOne&&(n=uG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:pG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Tj({},o[e],a);return mG(n)&&delete n.type,n.oneByOne&&(n=uG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:pG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function dG(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=I(t),fG(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function uG(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function pG(t,e){var i,s;return null!==(i=null==t?void 0:t[_D])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function gG(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function mG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function fG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),fG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),fG(t[i],e)}class vG extends yH{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=EF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Pj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Tj({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;Y(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=Tj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Tj({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class _G extends bH{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${hB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=vG,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=function(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Dz(this._rawData.dataSet,"invalidTravel",tG),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=Yz(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=Uz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Uz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new eG(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];i&&i.lockStatisticsByDomain&&i.domain?(this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain):this._rawStatisticsCache[t]=QN(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=$(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=X(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Dz(this._dataSet,"dimensionStatistics",JN);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new _a(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&Xj(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){Dz(this._dataSet,"dimensionStatistics",JN);const s=new _a(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=Xj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Xj(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new _a(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Dz(this._rawData.dataSet,"addVChartProperty",qN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:rG.bind(this),call:aG}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=cG({},dG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Qy(s)||tb(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=Tj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Tj(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:Jz.STATE_HOVER_REVERSE,highlightState:Jz.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:Jz.STATE_SELECTED_REVERSE,state:Jz.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:bD;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:xD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,xD)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new aN(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return G(a,Object.keys(t||{}).sort())?((i=null!=i?i:{data:!0}).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((s=>!i[s]&&!G(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof _a||Kz(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:bD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new HF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return RF(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:bD}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:m,parent:f,isSeriesMark:v,depend:_,progressive:y,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,T=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(T)){this._marks.addMark(T,{name:t.name}),v&&(this._seriesMark=T),u(f)?null===(i=this._rootMark)||void 0===i||i.addMark(T):!1!==f&&f.addMark(T),u(g)?(T.setDataView(this.getViewData(),this.getViewDataProductId()),T.setSkipBeforeLayouted(!0)):!1!==g&&T.setDataView(g,m),c(l)&&T.setSkipBeforeLayouted(l),p(_)&&T.setDepend(...Y(_));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}`),T.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(y)||T.setProgressiveConfig(y),u(o)||T.setGroupKey(o),A&&T.setCustomizedShapeCallback(A),k&&T.setStateSortCallback(k),S&&T.setClip(S),this.initMarkStyleWithSpec(T,Tj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:yD}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==MD&&t!==wD&&t!==kD&&t!==TD||(t=this.getStackValueField()),null!==(e=qj(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=CF[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>sb(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:bD]}}function yG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Dw(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function bG(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}_G.mark=ND,_G.transformerConstructor=vG;class xG extends _G{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);Dw(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${hB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(MD),this.setFieldX2(kD)):(this.setFieldY(MD),this.setFieldY2(kD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(wD),this.setFieldX2(TD)):(this.setFieldY(wD),this.setFieldY2(TD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(yG("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const SG="monotone",AG="linear";class kG{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark($D.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:AG,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===SG?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark($D.point,{morph:gG(this._spec,$D.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new _a(this._option.dataSet,{name:`${hB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[$D.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Tj({},this._spec[$D.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class MG extends zH{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(Fw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class TG extends MG{constructor(){super(...arguments),this.type=TG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===oB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}TG.type="line";const wG=()=>{hz.registerMark(TG.type,TG),fM(),aM(),kR.registerGraphic(RB.line,Sg),JH()};class CG extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class EG extends CG{constructor(){super(...arguments),this.type=EG.type}}EG.type="symbol";const PG=()=>{hz.registerMark(EG.type,EG),fO()};class BG extends vG{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class RG extends eV{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function LG(t,e,i,s){switch(t){case r.cartesianBandAxis:return RV(_z(i,["z"]),"band",e);case r.cartesianLinearAxis:return RV(_z(i,["z"]),"linear",e);case r.cartesianLogAxis:return RV(_z(i,["z"]),"log",e);case r.cartesianSymlogAxis:return RV(_z(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return RV(_z(i),void 0,e);case r.polarBandAxis:return LV(i.orient,"band",e);case r.polarLinearAxis:return LV(i.orient,"linear",e);case r.polarAxis:return LV(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=MV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>mz(t.orient)));let d;d=p(c)?Tj({},OV(c.type)?a:o,l):l;const u=n.find((t=>fz(t.orient)));let g;return g=p(u)?Tj({},jw(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=MV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Tj({},OV(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Tj({},jw(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return OG(i,MV(t,e));default:return MV(t,e)}}const OG=(t,e)=>{var i;const s=Tj({},e,e[yz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class IG extends yH{getTheme(t,e){return LG(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},$F(e)),{[s]:0}))}}class DG extends SH{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new RG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=IG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof tc||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new _H({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}DG.transformerConstructor=IG;class FG extends zH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(RB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}FG.type="component";const jG=()=>{hz.registerMark(FG.type,FG)},zG=t=>t;class HG extends DG{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,m,f,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?DB.circleAxisGrid:DB.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=cG(null===(o=hz.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(g=this._spec.animationEnter)&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new DH(this._option,t)]}collectData(t,e){const i=[];return sB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Dw(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return sB(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=nB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),sB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(sB(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;tthis._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=az(s=t.domainLine)).startSymbol=az(s.startSymbol),s.endSymbol=az(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return lz(Tj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:lz(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return lz(Tj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:lz(t.tick.style)),t.tick.state&&(i.tick.state=oz(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return lz(Tj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:lz(t.subTick.style)),t.subTick.state&&(i.subTick.state=oz(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=wV[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Qt(p):null,textStyle:Tj({},d,lz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:lz(h.style)}),h.state&&(i.title.state.shape=oz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:lz(o.style)}),o.state&&(i.title.state.background=oz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=oz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=lz(t.background.style)),t.background.state&&(i.panel.state=oz(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return lz(Tj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:lz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:lz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=TV(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Fz(this._option.dataSet,"scale",zG),Dz(this._option.dataSet,"ticks",UC);return new _a(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}HG.specKey="axes";const VG=()=>{kR.registerGraphicComponent(IB.lineAxis,((t,e)=>new Cw(t,e))),kR.registerGraphicComponent(IB.circleAxis,(t=>new Rw(t))),kR.registerComponent(LB.axis,FO),kR.registerGraphicComponent(DB.lineAxisGrid,((t,e)=>new qC(t,e))),kR.registerGraphicComponent(DB.circleAxisGrid,((t,e)=>new JC(t,e))),kR.registerComponent(LB.grid,HO),jG(),hz.registerAnimation("axis",(()=>({appear:{custom:Ow},update:{custom:Lw},exit:{custom:Gc}})))},NG=[bV];class GG extends HG{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{const e=this.getOrient();mz(e)?t.setXAxisHelper(this.axisHelper()):fz(e)?t.setYAxisHelper(this.axisHelper()):vz(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=Tj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Tj({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=mz(this.getOrient()),n=t=>{var e;return(s?!mz(t.getOrient()):mz(t.getOrient()))&&Dw(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=_z(i,["z"]),vz(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!PV(e))return null;const{axisType:t,componentName:s}=bz(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>fz(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!PV(t))return;const{axisType:s,componentName:n}=bz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=hz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];mz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):vz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(NG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){mz(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!mz(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!vz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;fz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=mz(this.getOrient())?t.fieldX:vz(this.getOrient())?t.fieldZ:t.fieldY,Dw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:Dw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(mz(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=mz(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return sB(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:mz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:vz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();sB(this._regions,(e=>{mz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):fz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):vz(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=mz(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=mz(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=Tj(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return IV(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=EV(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=WG?10:n>=UG?5:n>=YG?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class XG extends GG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}XG.type=r.cartesianLinearAxis,XG.specKey="axes",U(XG,KG);const $G=()=>{VG(),hz.registerComponent(XG.type,XG)};class qG{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=IV(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>IV(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class ZG extends GG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=qw(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{VG(),hz.registerComponent(ZG.type,ZG)};class QG extends XG{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{mz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Tj({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new DH(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=ci.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>IV(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>IV(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}QG.type=r.cartesianTimeAxis,QG.specKey="axes";class tW extends XG{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new EC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}tW.type=r.cartesianLogAxis,tW.specKey="axes",U(tW,KG);class eW extends XG{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}eW.type=r.cartesianSymlogAxis,eW.specKey="axes",U(eW,KG);class iW extends xG{constructor(){super(...arguments),this.type=oB.line,this.transformerConstructor=BG,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),dG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=bG(this);this._symbolMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),dG("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}iW.type=oB.line,iW.mark=qD,iW.transformerConstructor=BG,U(iW,kG);class sW{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{Kz(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof _a)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class nW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{nb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Xj(e,[{key:t,operations:Dw(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&Xj(e,[{key:i.field,operations:Dw(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?NF("colorOrdinal"):NF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(nb(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),nb(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!nb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Dw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Dw(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Dw(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Dw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class rW{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=Zj(t,!0);for(const e in a)for(const i in a[e].nodes)ez(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)tz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qj(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class aW extends pH{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=ib(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:cB,height:dB},this._viewRect={width:cB,height:dB},this._viewBox={x1:0,y1:0,x2:cB,y2:dB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=$F(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new Rz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new sW(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._spec.background&&"object"==typeof this._spec.background&&this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new rW(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=H(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=hz.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},t),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=hz.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof bH)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof zH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zH)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&Kz(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=nH(this._spec,this._option,{width:cB,height:dB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=RF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new nW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){rH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=RF(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{rH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};y(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,rH(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):rH(t,i.updateSpec(a))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];rH(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=XF(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(Jz.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Jz.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(Jz.STATE_SELECTED)}clearHovered(){this.clearState(Jz.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Pz.dimensionHover||s===Pz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>jw(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const oW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class lW{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);xj(t,r,l.spec),xj(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));xj(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=oW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=oW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(hz.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(hz.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=hz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hz.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=hz.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class hW extends lW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),R(i,"trimPadding")&&Tj(i,aH(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class cW extends hW{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),sH(t)}}class dW extends aW{constructor(){super(...arguments),this.transformerConstructor=cW,this.type="line",this.seriesType=oB.line,this._canStack=!0}}dW.type="line",dW.seriesType=oB.line,dW.transformerConstructor=cW;class uW extends MG{constructor(){super(...arguments),this.type=uW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}uW.type="area";const pW=()=>{hz.registerMark(uW.type,uW),fM(),qk(),kR.registerGraphic(RB.area,Wg),JH()};class gW extends aN{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const mW=()=>{hz.registerAnimation("area",qH),ZH(),XH()};class fW extends BG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=Tj({},m.style,g.style),l.state=Tj({},m.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class vW extends xG{constructor(){super(...arguments),this.type=oB.area,this.transformerConstructor=fW,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(vW.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===SG?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return GF(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return GF(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),dG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),dG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=bG(this);this._symbolMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),dG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new gW(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}vW.type=oB.area,vW.mark=JD,vW.transformerConstructor=fW,U(vW,kG);class _W extends hW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),sH(t)}}class yW extends aW{constructor(){super(...arguments),this.transformerConstructor=_W,this.type="area",this.seriesType=oB.area,this._canStack=!0}}yW.type="area",yW.seriesType=oB.area,yW.transformerConstructor=_W;function bW(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const xW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:bW(t,e)}),SW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:bW(t,e)}),AW={type:"fadeIn"},kW={type:"growCenterIn"};function MW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AW;case"scaleIn":return kW;default:return xW(t)}}class TW extends zH{constructor(){super(...arguments),this.type=TW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TW.type="rect";const wW=()=>{hz.registerMark(TW.type,TW),gO(),uO.useRegisters([VI,NI,GI,WI,zI,HI])};function CW(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[GD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):GF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WD]):GF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[UD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):GF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YD]):GF(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},BW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:gG(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(BW.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(Dz(this._option.dataSet,"addVChartProperty",qN),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};Dz(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new _a(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:rG.bind(this),call:aG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new eG(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=YD,s=UD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=WD,s=GD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zj(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)CW(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=GF(this[n](t),o),d=GF(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[kD],n=t[MD],r=t[TD],h=t[wD];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[kD]:i,[MD]:s}),a?{[TD]:o,[wD]:l}:void 0);t.push(Mg(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>GF(this._dataToPosY(t),a),y1:t=>GF(this._dataToPosY1(t),a)}:{y:t=>GF(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>GF(this._dataToPosX(t),r),x1:t=>GF(this._dataToPosX1(t),r)}:{x:t=>GF(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=bG(this);this._barMark.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),dG(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6;if(void 0!==this._spec.barWidth&&r===n)return ZF(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,ZF(this._spec.barMinWidth,a))),l&&(h=Math.min(h,ZF(this._spec.barMaxWidth,a))),h}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=ZF(null!==(l=i[r-1])&&void 0!==l?l:K(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=Dw(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}BW.type=oB.bar,BW.mark=KD,BW.transformerConstructor=PW;const RW=()=>{iI(),wW(),hz.registerAnimation("bar",((t,e)=>({appear:MW(t,e),enter:xW(t,!1),exit:SW(t,!1),disappear:SW(t)}))),JG(),$G(),hz.registerSeries(BW.type,BW)};class LW extends hW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),sH(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class OW extends aW{constructor(){super(...arguments),this.transformerConstructor=LW,this.type="bar",this.seriesType=oB.bar,this._canStack=!0}}OW.type="bar",OW.seriesType=oB.bar,OW.transformerConstructor=LW;class IW extends zH{constructor(){super(...arguments),this.type=IW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}IW.type="rect3d";class DW extends BW{constructor(){super(...arguments),this.type=oB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}DW.type=oB.bar3d,DW.mark=XD;class FW extends LW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class jW extends OW{constructor(){super(...arguments),this.transformerConstructor=FW,this.type="bar3d",this.seriesType=oB.bar3d}}jW.type="bar3d",jW.seriesType=oB.bar3d,jW.transformerConstructor=FW;const zW=[10,20],HW=Pw.Linear,VW="circle",NW=Pw.Ordinal,GW=["circle","square","triangle","diamond","star"],WW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class UW extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class YW extends xG{constructor(){super(...arguments),this.type=oB.scatter,this.transformerConstructor=UW,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${hB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${hB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:HW,defaultRange:zW},"size")}getShapeAttribute(t,e){return u(e)?VW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:NW,defaultRange:GW},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(YW.mark.point,{morph:gG(this._spec,YW.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=bG(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),dG("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:VW},Jz.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},Jz.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}YW.type=oB.scatter,YW.mark=ZD,YW.transformerConstructor=UW;const KW=()=>{PG(),hz.registerAnimation("scatter",((t,e)=>Object.assign({appear:WW(0,e)},YH))),JG(),$G(),hz.registerSeries(YW.type,YW)};class XW extends hW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class $W extends aW{constructor(){super(...arguments),this.transformerConstructor=XW,this.type="scatter",this.seriesType=oB.scatter,this._canStack=!0}}$W.type="scatter",$W.seriesType=oB.scatter,$W.transformerConstructor=XW;Rn();const qW={},ZW=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function JW(t,e){t&&_(t)||ob("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(qW[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Rn().projection(s),s.copy=s.copy||function(){const t=i();return ZW.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),qW[i]||null}const QW={albers:Zn,albersusa:function(){var t,e,i,s,n,r,a=Zn(),o=qn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=qn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(QW).forEach((t=>{JW(t,QW[t])}));const tU="Feature",eU="FeatureCollection";function iU(t){const e=Y(t);return 1===e.length?e[0]:{type:eU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===eU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===tU?t:{type:tU,geometry:t}))}(e))),[])}}const sU=ZW.concat(["pointRadius","fit","extent","size"]);function nU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{sU.includes(s)&&(i=i.concat(dR(t[s],e)))})),i):i}let rU=class extends $R{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(dR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(dR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(dR(this.spec.size,this.view)),this.spec.size=t,this.attach(dR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(dR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(dR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(dR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(dR(t,this.view)),this.commit(),this}configure(t){return this.detach(nU(this.spec,this.view)),u(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(nU(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=JW((t||"mercator").toLowerCase());return e||ob("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),ZW.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,pR(this.spec[t],e,JW))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(pR(this.spec.pointRadius,e,JW)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=iU(pR(this.spec.fit,e,JW));this.spec.extent?this.projection.fitExtent(pR(this.spec.extent,e,JW),t):this.spec.size&&this.projection.fitSize(pR(this.spec.size,e,JW),t)}return this.projection}output(){return this.projection}};const aU=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class oU extends _G{constructor(){super(...arguments),this.type=oB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${hB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const lU=`${hB}_MAP_LOOK_UP_KEY`,hU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[_D]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[lU]=e.nameMap[n]:t[lU]=n})),t.features);class cU extends aN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class dU extends zH{constructor(){super(...arguments),this.type=dU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}dU.type="path";const uU=()=>{hz.registerMark(dU.type,dU),pO()};class pU{constructor(t){this.projection=JW(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class gU{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class mU{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function fU(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:gU}:Qy(e)||tb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:mU}:null}const vU={debounce:bt,throttle:xt};class _U{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=Qy(this._renderMode)||tb(this._renderMode),fU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return fU(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;u(n)||Ie({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,vU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,vU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||fU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:Ie({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,vU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,vU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){fU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fU(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;Ie({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||fU(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||fU(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,m=u.canvasX,f=u.canvasY;const v=vU[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-m,s.canvasY-f];m=s.canvasX,f=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v)}),l),_=vU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},_),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function yU(t,e){return`${hB}_${e}_${t}`}class bU extends DG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:yU(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Tj(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new pU(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===oB.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),sB(this._regions,(t=>{var e;if(t.type===oB.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new ae})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===oB.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[lU],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}bU.type=r.geoCoordinate,U(bU,_U);const xU=()=>{hz.registerComponent(bU.type,bU)};class SU extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class AU extends oU{constructor(){super(...arguments),this.type=oB.map,this.transformerConstructor=SU,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),jz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Dz(this._dataSet,"copyDataView",Wz),Dz(this._dataSet,"map",hU),Dz(this._dataSet,"lookup",aU);const i=jz.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new _a(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:Xz.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:lU,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new eG(this._option,s)}initMark(){this._pathMark=this._createMark(AU.mark.area,{morph:gG(this._spec,AU.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:bD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:bD]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(cG(null===(t=hz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),dG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new cU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[_D]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[_D],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new ae}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new ae}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return _D}getActiveMarks(){return[this._pathMark]}}AU.type=oB.map,AU.mark=sF,AU.transformerConstructor=SU;const kU=()=>{kR.registerGrammar("projection",rU,"projections"),xU(),uU(),hz.registerSeries(AU.type,AU),hz.registerImplement("registerMap",Vz),hz.registerImplement("unregisterMap",Nz),$H()},MU=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[RD]=!0:delete t[RD]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=TU([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=wU(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Yt(_,e)):(t[c]=+y,y=Yt(y,e)),t[d]=Yt(t[c],e),f=Yt(f,e),b=Kt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=TU(a,t,n,r,h,l,i,e),r.push(n)})),r};function TU(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=wU(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Yt(i.positive,e)):(t[h]=+i.negative,i.negative=Yt(i.negative,e)),t[c]=Yt(t[h],e),i.end=Yt(i.end,e)}i.isTotal=e,(u(p)||p===pD)&&(t[pD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function wU(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?Ky("total.collectCountField error"):n=e[a].start;o<0?Ky("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Yt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const CU=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Yt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},EU={type:"fadeIn"},PU={type:"growCenterIn"};function BU(t,e){switch(e){case"fadeIn":return EU;case"scaleIn":return PU;default:return xW(t,!1)}}class RU extends zH{constructor(){super(...arguments),this.type=RU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}RU.type="rule";const LU=()=>{hz.registerMark(RU.type,RU),mO()},OU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:IU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function IU(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>IU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class DU{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new _a(e instanceof fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),Dz(e,"dimensionTree",OU),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class FU extends PW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const jU={rect:GU,symbol:VU,arc:UU,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=VU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:YU,line:KU,area:KU,rect3d:GU,arc3d:UU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function zU(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=TV(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function HU(t){return d(t)?e=>t(e.data):t}function VU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=HU(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:NU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function NU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function GU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=HU(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;_(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:WU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function WU(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function UU(t){var e;const{labelSpec:i}=t,s=null!==(e=HU(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function YU(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=zU(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),gp(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function KU(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class XU extends BW{constructor(){super(...arguments),this.type=oB.waterfall,this.transformerConstructor=FU,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new DU(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],u(this._seriesField)&&(this._seriesField=pD)}getSeriesKeys(){return this._seriesField===pD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Dz(this._dataSet,"waterfallFillTotal",CU),Dz(this._dataSet,"waterfall",MU),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=Uz(this.getViewData(),this._dataSet,{name:`${hB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new eG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:kD,endAs:MD,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=bG(this);this._barMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),dG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),dG("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(XU.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=t);this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Kt(t.end,t.start)}})}}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Kt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return YU(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?GF(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):GF(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}XU.type=oB.waterfall,XU.mark=uF,XU.transformerConstructor=FU;const $U=()=>{LU(),wW(),hz.registerAnimation("waterfall",((t,e)=>({appear:BU(t,e),enter:xW(t,!1),exit:SW(t,!1),disappear:SW(t,!1)}))),$H(),JG(),$G(),hz.registerSeries(XU.type,XU)},qU=`${hB}_BOX_PLOT_OUTLIER_VALUE`;var ZU;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(ZU||(ZU={}));const JU=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[qU]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class QU extends aN{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===ZU.OUTLIER)return this.series.getOutliersField();if(t===ZU.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case ZU.MIN:return this.series.getMinField();case ZU.MAX:return this.series.getMaxField();case ZU.MEDIAN:return this.series.getMedianField();case ZU.Q1:return this.series.getQ1Field();case ZU.Q3:return this.series.getQ3Field();case ZU.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===ZU.OUTLIER)return e[qU];if(t===ZU.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case ZU.MIN:return e[this.series.getMinField()];case ZU.MAX:return e[this.series.getMaxField()];case ZU.MEDIAN:return e[this.series.getMedianField()];case ZU.Q1:return e[this.series.getQ1Field()];case ZU.Q3:return e[this.series.getQ3Field()];case ZU.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[qU])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(ZU.OUTLIER),value:this.getContentValue(ZU.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(ZU.MAX),value:this.getContentValue(ZU.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.Q3),value:this.getContentValue(ZU.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.MEDIAN),value:this.getContentValue(ZU.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.Q1),value:this.getContentValue(ZU.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.MIN),value:this.getContentValue(ZU.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.SERIES_FIELD),value:this.getContentValue(ZU.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class tY extends zH{constructor(){super(...arguments),this.type=tY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}tY.type="boxPlot";const eY=()=>{hz.registerMark(tY.type,tY),kR.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(SO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&_b(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&_b(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&_b(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&_b(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&_b(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&_b(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&_b(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&_b(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),kR.registerAnimationType("boxplotScaleIn",AO),kR.registerAnimationType("boxplotScaleOut",kO),_O(),gO(),mO(),kR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(TO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&_b(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&_b(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&_b(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&_b(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&_b(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),kR.registerAnimationType("barBoxplotScaleIn",wO),kR.registerAnimationType("barBoxplotScaleOut",CO),_O(),gO(),mO()};class iY extends xG{constructor(){super(...arguments),this.type=oB.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(iY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(iY.mark.outlier,{progressive:t,key:_D,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,Jz.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>GF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>GF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>GF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>GF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>GF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},Jz.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>GF(e(this.getDatumPositionValues(t,qU),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>GF(e(this.getDatumPositionValues(t,qU),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,Jz.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"foldOutlierData",JU),Dz(this._dataSet,"addVChartProperty",qN);const t=new _a(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${hB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:rG.bind(this),call:aG}},!1),this._outlierDataView=new eG(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=bG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(dG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(cG(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(cG(null===(a=hz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new QU(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}iY.type=oB.boxPlot,iY.mark=pF;class sY extends zH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=sY.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}sY.type="text";const nY=()=>{hz.registerMark(sY.type,sY),vO(),fM(),gM(),kR.registerGraphic(RB.richtext,jg)};function rY(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class aY extends aN{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const oY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),lY={type:"fadeIn"},hY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function cY(t,e){return"fadeIn"===e?lY:oY(t)}class dY extends PW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class uY extends BW{constructor(){super(...arguments),this.type=oB.rangeColumn,this._barMarkType="rect",this._barName=oB.bar,this.transformerConstructor=dY}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(uY.mark.bar,{morph:gG(this._spec,uY.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(uY.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(uY.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});rY(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});rY(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=bG(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),dG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),dG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(cG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),dG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new aY(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}uY.type=oB.rangeColumn,uY.mark=yF,uY.transformerConstructor=dY;const pY=()=>{wW(),nY(),hz.registerAnimation("rangeColumn",((t,e)=>({appear:cY(t,e),enter:oY(t),exit:hY(t),disappear:hY(t)}))),$H(),JG(),$G(),hz.registerSeries(uY.type,uY)};class gY extends uY{constructor(){super(...arguments),this.type=oB.rangeColumn3d,this._barMarkType="rect3d",this._barName=oB.bar3d}}gY.type=oB.rangeColumn3d,gY.mark=bF;class mY extends aN{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class fY extends vW{constructor(){super(...arguments),this.type=oB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(fY.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new mY(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}fY.type=oB.rangeArea,fY.mark=kF;class vY extends _G{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=EB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),s=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Dw(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};Dw(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),p(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),p(this._spec.radius)&&(this._outerRadius=this._spec.radius),p(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&yG(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const _Y=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:s,startAngle:n,endAngle:r,minAngle:a,asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=e,g=(t,e,i)=>{t[o]=e,t[l]=e+i,t[h]=e+i/2,t[c]=i,t[u]=function(t){return(t=ne(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let m=0,f=-1/0;for(let t=0;tNumber(t[s]))),y=r-n;let b=n,x=y,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(_);if(i.forEach(((t,e)=>{const i=t[_B],s=m?i/m:0;let n=s*y;n{g(e,n+i*t,t)}))}else{const t=x/S;b=n,i.forEach((e=>{const i=e[c]===a?a:e[_B]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function yY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const bY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:yY(t,!0,qz.appear)}),xY={type:"fadeIn"},SY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:yY(t,!0,qz.enter)}),AY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:yY(t,!0,qz.exit)}),kY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:yY(t,!0,qz.exit)});function MY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return xY;case"growRadius":return bY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return bY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class TY extends zH{constructor(t,e){super(t,e),this.type=wY.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>ie({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[AB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class wY extends TY{constructor(){super(...arguments),this.type=wY.type}}wY.type="arc";const CY=()=>{fM(),Xk(),kR.registerGraphic(RB.arc,Kg),uO.useRegisters([QI,tD,ZI,JI]),hz.registerMark(wY.type,wY)};class EY extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=Tj({},this._theme,i,t);const n=(t,e)=>Tj({},"inside"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}class PY extends vY{constructor(){super(...arguments),this.transformerConstructor=EY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=TB,this._endAngle=wB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[AB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ie(this.computeCenter(t),(i+s)/2,e)}}getCenter(){var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?Qt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Qt(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?Qt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Dz(this._dataSet,"pie",_Y),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,minAngle:p(this._spec.minAngle)?Qt(this._spec.minAngle):0,asStartAngle:bB,asEndAngle:xB,asRatio:yB,asMiddleAngle:AB,asRadian:MB,asQuadrant:kB,asK:SB}},!1);const e=new _a(this._dataSet,{name:`${hB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new eG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},PY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:gG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:yD,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return aB(bB)(t)}endAngleScale(t){return aB(xB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:WF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:WF(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:aB(mB).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){(i=null!=i?i:{data:!0}).centerX=!0,i.centerX=!0,i.centerY=!0,i.centerOffset=!0,i.radius=!0,i.innerRadius=!0,i.cornerRadius=!0,i.startAngle=!0,i.endAngle=!0,i.padAngle=!0;const{centerX:s,centerY:n,centerOffset:r,radius:a,innerRadius:o,cornerRadius:l,startAngle:h,endAngle:c,padAngle:d}=e,u=super._compareSpec(t,e,i);return(t=null!=t?t:{}).centerY===n&&t.centerX===s&&t.centerOffset===r&&t.radius===a&&t.innerRadius===o&&t.cornerRadius===l&&t.startAngle===h&&t.endAngle===c&&t.padAngle===d||(u.reRender=!0,u.change=!0),u}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[AB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ie(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===qz.appear)return this._startAngle;if(i===qz.disappear)return this._endAngle;const n=[qz.disappear,qz.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[_D];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ie({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[AB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ie({x:0,y:0},a,e[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[AB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}PY.transformerConstructor=EY,PY.mark=tF;class BY extends PY{constructor(){super(...arguments),this.type=oB.pie}}BY.type=oB.pie;const RY=()=>{CY(),hz.registerAnimation("pie",((t,e)=>({appear:MY(t,e),enter:SY(t),exit:AY(t),disappear:kY(t)}))),hz.registerSeries(BY.type,BY)};class LY extends TY{constructor(){super(...arguments),this.type=LY.type,this._support3d=!0}}LY.type="arc3d";class OY extends EY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class IY extends PY{constructor(){super(...arguments),this.type=oB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=OY}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[AB];return"inside"===i.position?te(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}IY.type=oB.pie3d,IY.mark=eF,IY.transformerConstructor=OY;const DY=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},FY={type:"fadeIn"},jY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),zY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),HY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function VY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return FY;case"growAngle":return DY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return DY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class NY extends vY{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(MD),this.setInnerRadiusField(kD)}setValueFieldToPercent(){this.setRadiusField(wD),this.setInnerRadiusField(TD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class GY extends vG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const WY=(t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:CB,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:EB,layoutRadius:e.layoutRadius}};class UY extends HG{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e)){if(!BV(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=WY(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s;const n=[];return e.forEach(((e,r)=>{if(!BV(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=WY(e,t);e.center=c,e.startAngle=l,e.endAngle=h,e.outerRadius=d,e.type=a,e.layoutRadius=u;const p={spec:e,specPath:[this.specKey,r],specInfoPath:["component",this.specKey,r],type:o};i.push(p),"radius"===e.orient?n.push(p):s=r})),n.forEach((t=>{t.angleAxisIndex=s})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=hz.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=TB,this._endAngle=wB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Qt(this._spec.startAngle),this._endAngle=Qt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:CV(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){sB(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Dw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Dw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this.computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ie(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:KF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:KF(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>IV(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),s=this._endAngle-this._startAngle,n=this.getLabelItems(s),r=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle}),a=Object.assign(Object.assign({},r),{title:{text:this._spec.title.text||this._dataFieldText},items:n,orient:"angle"});this._spec.grid.visible&&(a.grid=Object.assign({type:"line",smoothLink:!0,items:n[0]},r)),this._update(a)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=$t.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAngleAxis())||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAngleAxis(){const t=this._option.angleAxisIndex;if(p(t))return this._option.getComponentByIndex(this.specKey,t)}computeLayoutRadius(){const t=this.getRefLayoutRect();if(S(this._spec.layoutRadius))return this._spec.layoutRadius;if(d(this._spec.layoutRadius))return this._spec.layoutRadius(t,this.getCenter());const{width:e,height:i}=t;return"auto"===this._spec.layoutRadius&&e>0&&i>0?re(t,this.getCenter(),this._startAngle,this._endAngle):Math.min(e/2,i/2)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this.computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this.computeLayoutRadius()*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=EB,e=0;const i=this.getChart().getSpec();return sB(this.getRegions(),(s=>{const n=s;if(r=n.type,[oB.rose,oB.radar,oB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(Tj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Tj({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}UY.type=r.polarAxis,UY.specKey="axes";class YY extends UY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}}YY.type=r.polarLinearAxis,YY.specKey="axes",U(YY,KG);const KY=()=>{VG(),hz.registerComponent(YY.type,YY)};class XY extends UY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}XY.type=r.polarBandAxis,XY.specKey="axes",U(XY,qG);const $Y=()=>{VG(),hz.registerComponent(XY.type,XY)};class qY extends NY{constructor(){super(...arguments),this.type=oB.rose,this.transformerConstructor=GY,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(qY.mark.rose,{morph:gG(this._spec,qY.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>GF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=GF(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),dG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}qY.type=oB.rose,qY.mark=iF,qY.transformerConstructor=GY;const ZY=()=>{hz.registerSeries(qY.type,qY),CY(),hz.registerAnimation("rose",((t,e)=>({appear:VY(t,e),enter:jY(t),exit:zY(t),disappear:HY(t)}))),$Y(),KY()};class JY extends gc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class QY extends zc{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1}),r=ne(s.angle),a=ne(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=ne(o.angle),c=ne(l.angle),d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:m,y:f}=this._coordToPoint({angle:d,radius:u}),{x:v,y:_}=this._coordToPoint({angle:p,radius:g}),y=new Xt(m,f,v,_);return y.defined=e.defined,y}}const tK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function eK(t,e,i){return"fadeIn"===e?tK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function iK(t,e,i){return"fadeIn"===e?tK(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const sK=(t,e)=>({custom:Vc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class nK extends NY{constructor(){super(...arguments),this.type=oB.radar,this.transformerConstructor=BG,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(nK.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:AG,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?Qt(this._spec.startAngle):TB,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),dG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=hz.getAnimationInKey(e);t.setAnimationConfig(cG(null==i?void 0:i(n,r),dG(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}nK.type=oB.radar,nK.mark=QD,nK.transformerConstructor=BG,U(nK,kG);const rK=()=>{hz.registerSeries(nK.type,nK),sI(),pW(),wG(),PG(),hz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:eK(t,e,"in"),enter:eK(t,e,"in"),exit:eK(t,e,"out"),disappear:"clipIn"===e?void 0:eK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:QY,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:iK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:iK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:JY,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarGroup",((t,e)=>({appear:sK(t,"in"),disappear:sK(t,"out")}))),Xk(),$Y(),KY()};class aK extends aN{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>ci.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const oK=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},lK={fill:"#bbb",fillOpacity:.2};class hK extends xG{constructor(){super(...arguments),this.type=oB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),Dz(this._option.dataSet,"objFlat",oK),Dz(this._option.dataSet,"copyDataView",Wz),Fz(this._option.dataSet,"dataview",pa),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:Xz.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Tj(lK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(hK.mark.group),this._containerMark=this._createMark(hK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(hK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(hK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(hK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(hK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(hK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(hK.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:bD}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new HF).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:bD}}initTooltip(){this._tooltipHelper=new aK(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}hK.type=oB.dot,hK.mark=oF;class cK extends aN{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>ci.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const dK=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class uK extends xG{constructor(){super(...arguments),this.type=oB.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Dz(this._option.dataSet,"linkDotInfo",dK),null===(t=this.getViewData())||void 0===t||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:Xz.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(uK.mark.group),this._containerMark=this._createMark(uK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(uK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(uK.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:bD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new cK(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}uK.type=oB.link,uK.mark=aF;class pK extends vY{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?kD:LD],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Qt(i.offsetAngle);let o;if(p(s)){const t=ot(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?MD:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Qt(i.offsetAngle),o=ot(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?Qt(n):TB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?Qt(r):wB,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[kD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[MD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(pK.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+Qt(s),n=Qt(i)/2;return Kg(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Mg({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const fK=()=>{hz.registerAnimation("circularProgress",((t,e)=>({appear:mK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class vK extends vG{constructor(){super(...arguments),this._supportStack=!0}}class _K extends pK{constructor(){super(...arguments),this.type=oB.circularProgress,this.transformerConstructor=vK,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(_K.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(_K.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?kD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?MD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),dG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),dG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}_K.type=oB.circularProgress,_K.mark=rF,_K.transformerConstructor=vK;function yK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const bK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:yK(t)}),xK={type:"fadeIn"};function SK(t,e){return!1===e?{}:"fadeIn"===e?xK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:yK(t)}))(t)}class AK extends aN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class kK extends xG{constructor(){super(...arguments),this.type=oB.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(kK.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return GF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return GF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return GF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return GF(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(kK.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return GF(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return GF(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(kK.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=GF(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(Mg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=GF(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(Mg({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),dG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),dG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new AK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}kK.type=oB.linearProgress,kK.mark=dF;const MK=()=>{wW(),hz.registerAnimation("linearProgress",((t,e)=>({appear:SK(t,e),enter:{type:"grow"},disappear:bK(t)}))),$H(),hz.registerSeries(kK.type,kK)},TK=[0],wK=[20,40],CK=[200,500],EK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},PK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],BK=`${hB}_WORD_CLOUD_WEIGHT`,RK=`${hB}_WORD_CLOUD_TEXT`;class LK extends _G{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=wK}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:CK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:TK,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?RK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:EK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:TK,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!PK.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark(LK.mark.word,{key:yD,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(cG(hz.getAnimationInKey("wordCloud")(n,s),dG("word",this._spec,this._markAttributeContext)))}}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new HF).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:bD])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new TC,o=this._fontWeightRange;if(r){const[e,i]=ub(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:BK,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:RK,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:Jy(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:yD,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:BK}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:yD,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:BK}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}LK.mark=lF;function OK(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||UH.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function DK(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function FK(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const jK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function zK(t){return d(t)?t:function(){return t}}class HK{constructor(t){var e,i,s;switch(this.options=z({},HK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,IK[s]?IK[s]():IK.circle()),this.getText=null!==(e=zK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=zK(this.options.fontWeight),this.getTextFontSize=zK(this.options.fontSize),this.getTextFontStyle=zK(this.options.fontStyle),this.getTextFontFamily=zK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>jK(10,50);break;case"random-light":this.getTextColor=()=>jK(50,90);break;default:this.getTextColor=zK(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return Qt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return Qt(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class NK extends HK{constructor(t){var e;super(z({},NK.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=NK.defaultOptions.minFontSize&&(this.options.minFontSize=NK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=VK[this.options.spiral])&&void 0!==e?e:VK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=zK(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=FK(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>1))/o),e.angle&&a.rotate(e.angle),a.fillText(e.text,0,0),e.padding&&(a.lineWidth=2*e.padding,a.strokeText(e.text,0,0)),a.restore(),e.width=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(E_.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(YK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(UK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}YK(p,this._size)&&(p=KK(p,this._size))}else if(YK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||WK(p,i))&&(!i||!GK(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function GK(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function WK(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,YK=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function KK(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)P(C,w,T);return{datum:t,occupied:T,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=FK(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}$K.defaultOptions={enlarge:!1};const ZK={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},JK=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return rt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?QK(t.fontFamily):"sans-serif",d=t.fontStyle?QK(t.fontStyle):"normal",u=t.fontWeight?QK(t.fontWeight):"normal",p=t.rotate?QK(t.rotate):0,g=QK(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?QK(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,A=t.randomVisible,k=t.as||ZK,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?QK(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=eX(iX(t,l),C);w=i=>e(t(i))}let E=NK;"fast"===t.layoutType?E=$K:"grid"===t.layoutType&&(E=XK);const P=new E({text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:P}:P.output()},QK=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],tX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),eX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=tX(t[0]),s=tX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(tX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},iX=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function sX(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{kR.registerTransform("wordcloud",{transform:JK,markPhase:"beforeJoin"},!0),nY(),hz.registerAnimation("wordCloud",((t,e)=>({appear:OK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),hz.registerSeries(nX.type,nX)};(class extends LK{constructor(){super(...arguments),this.type=oB.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(LK.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),dG("word",this._spec,this._markAttributeContext)))}}).type=oB.wordCloud3d;const aX=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(y*v)&&0!==v?y/v:0,S=k(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},oX=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},lX=`${hB}_FUNNEL_TRANSFORM_RATIO`,hX=`${hB}_FUNNEL_REACH_RATIO`,cX=`${hB}_FUNNEL_HEIGHT_RATIO`,dX=`${hB}_FUNNEL_VALUE_RATIO`,uX=`${hB}_FUNNEL_LAST_VALUE_RATIO`,pX=`${hB}_FUNNEL_NEXT_VALUE_RATIO`,gX=`${hB}_FUNNEL_LAST_VALUE`,mX=`${hB}_FUNNEL_CURRENT_VALUE`,fX=`${hB}_FUNNEL_NEXT_VALUE`,vX=`${hB}_FUNNEL_TRANSFORM_LEVEL`,_X=20;class yX extends aN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[hX])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class bX extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class xX extends bX{constructor(){super(...arguments),this.type=xX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}xX.type="polygon";const SX=()=>{hz.registerMark(xX.type,xX),fM(),cM(),kR.registerGraphic(RB.polygon,qg),uO.useRegisters([UI,YI])};class AX extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class kX extends _G{constructor(){super(...arguments),this.type=oB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=AX,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"funnel",aX),Dz(this._dataSet,"funnelTransform",oX);const t=new _a(this._dataSet,{name:`${hB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new eG(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:mX,asTransformRatio:lX,asReachRatio:hX,asHeightRatio:cX,asValueRatio:dX,asNextValueRatio:pX,asLastValueRatio:uX,asLastValue:gX,asNextValue:fX,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:vX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},kX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:gG(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},kX.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(kX.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(kX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new yX(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*aB(hX).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),dG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(cG(hz.getAnimationInKey("fadeInOut")(),dG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(cG(hz.getAnimationInKey("funnel")({},o),dG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(cG(null===(a=hz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),dG("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[uX])/2:this._getSecondaryAxisLength(t[dX])/2,n=this._getSecondaryAxisLength(t[dX])/2):(s=this._getSecondaryAxisLength(t[dX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[pX])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[vX])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[yD]===t[yD]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?_X:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,m=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let f,v,_,y;if(this._isHorizontal()){const e=null!==(c=m.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==m.alignLabel?(null==p?void 0:p.y2)+e:_-e,f=this._getPolygonCenter(i).x,_-y<_X&&(y=_-_X),v=f):(_=this._getPolygonCenter(i).y+s/2+e,y=!1!==m.alignLabel?(null==p?void 0:p.y1)-e:_+e,f=this._getPolygonCenter(i).x,y-_<_X&&(y=_+_X),v=f),{x1:f,x2:v,y1:_,y2:y}}const b=this.getPoints(t),x=(Math.abs(b[0].x-b[1].x)+Math.abs(b[2].x-b[3].x))/2,S=(null==g?void 0:g.x2)-(null==g?void 0:g.x1)||0,A=null!==(d=m.spaceWidth)&&void 0!==d?d:5;return"right"===this._spec.outerLabel.position||"left"===this._funnelAlign?(f=this._getPolygonCenter(b).x+Math.max(S/2,x/2)+A,v=!1!==m.alignLabel?(null==p?void 0:p.x1)-A:f+A,_=this._getPolygonCenter(b).y,v-f<_X&&(v=f+_X),y=_):(f=this._getPolygonCenter(b).x-Math.max(S/2,x/2)-A,v=!1!==m.alignLabel?(null==p?void 0:p.x2)+A:f-A,_=this._getPolygonCenter(b).y,f-v<_X&&(v=f-_X),y=_),{x1:f,x2:v,y1:_,y2:y}}_computeMaxSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return KF(null!==(t=this._spec.maxSize)&&void 0!==t?t:"80%",e)}_computeMinSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return KF(null!==(t=this._spec.minSize)&&void 0!==t?t:0,e)}_isHorizontal(){return"left"===this._funnelOrient||"right"===this._funnelOrient}_isReverse(){return"bottom"===this._funnelOrient||"right"===this._funnelOrient}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._funnelMark]}}kX.type=oB.funnel,kX.mark=hF,kX.transformerConstructor=AX;const MX=()=>{SX(),nY(),LU(),hz.registerSeries(kX.type,kX),hz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KH))),hz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Nc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Nc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),$H()};class TX extends bX{constructor(){super(...arguments),this.type=TX.type}}TX.type="pyramid3d";class wX extends AX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class CX extends kX{constructor(){super(...arguments),this.type=oB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=wX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},CX.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},CX.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(CX.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(CX.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}CX.type=oB.funnel3d,CX.mark=cF,CX.transformerConstructor=wX;const EX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},PX=t=>{const e=t.mark.elements.filter((t=>t.diffState===BB.update)),i=$(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},BX=(t,e,i)=>{if(B(t))return[e,i];const s=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},RX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=PX(i),a=BX(r,s,n);return EX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=PX(i),a=BX(r,s,n);return EX(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),LX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},OX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=PX(i),a=LX(r);return EX(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=PX(i),a=LX(r);return EX(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),IX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},DX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):DX(t.children,e,i)))})),e};function FX(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=HX(t.children,d.children,i+1,o,d,r);d.value=u(t.value)?e.sum:Math.max(e.sum,Tt(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=Tt(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},VX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=VX(t.children,e,t,n))})),s},NX=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=NX(t.children,e,t,n)),n=e(t,s,i,n)})),n},GX={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:FX,slice:jX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?jX:FX)(t,e,i,s,n)}};class WX{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},WX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?hb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?zX(this.options.aspectRatio):null!==(e=GX[this.options.splitType])&&void 0!==e?e:GX.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=HX(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}WX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const UX=(t,e)=>{const i=new WX(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return DX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},YX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class KX{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];FX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),YX);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},KX.defaultOpionts,t):Object.assign({},KX.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?hb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+gb(this.options.center[0],t.width),s=t.y0+gb(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>gb(t,n))):gb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>gb(t,n))):gb(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=gb(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=HX(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ie({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}KX.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const XX=4294967296;function $X(t,e){let i,s;if(JX(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function JX(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function i$(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function s$(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function n$(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function r$(t){return{_:t,next:null,prev:null}}function a$(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];i$(n,s,r);let a,o,l,h,c,d,u,p=r$(s),g=r$(n),m=r$(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=HX(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%XX)/XX}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:c$.defaultOpionts.nodeSort;VX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)VX([o],o$(h)),NX([o],l$(this._getPadding,.5,a)),VX([o],h$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);VX([o],o$(c$.defaultOpionts.setRadius)),NX([o],l$(db,1,a)),c&&NX([o],l$(this._getPadding,o.radius/t,a)),VX([o],h$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}c$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const d$=(t,e={})=>{if(!t)return[];const i=[];return DX(t,i,e),i},u$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new KX(i).layout(t,{width:s,height:n})};class p$ extends aN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var g$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(g$||(g$={}));const m$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===g$.DrillDown){return Y(sz(t,n,s,"children"))}if(i.type===g$.DrillUp){const e=nz(t,n,s,"children");if(e)return Y(e)}return t};class f${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=fU(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Dz(t,"drillFilter",m$),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||B(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:g$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:g$.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||B(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:g$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:g$.DrillUp},model:this}),r}}class v$ extends vY{constructor(){super(...arguments),this.type=oB.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:sG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:yD},getRawData:()=>this.getRawData()}),this._startAngle=Qt(this._spec.startAngle),this._endAngle=Qt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Dz(this._dataSet,"sunburstLayout",u$),Dz(this._dataSet,"flatten",d$),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:iG,operations:["max","min","values"]},{key:sG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",qN),t.transform({type:"addVChartProperty",options:{beforeCall:oG.bind(this),call:lG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(v$.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(v$.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new p$(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),dG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),dG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}v$.type=oB.sunburst,v$.mark=_F,U(v$,f$);const _$=()=>{hz.registerSeries(v$.type,v$),CY(),nY(),$H(),hz.registerAnimation("sunburst",((t,e)=>({appear:IX(0,e),enter:RX(t),exit:OX(t),disappear:OX(t)})))},y$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new c$(i).layout(t,{width:s,height:n})};class b$ extends aN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const x$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class S$ extends xG{constructor(){super(...arguments),this.type=oB.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:sG),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:yD},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Dz(this._dataSet,"circlePackingLayout",y$),Dz(this._dataSet,"flatten",d$),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",qN),t.transform({type:"addVChartProperty",options:{beforeCall:oG.bind(this),call:lG}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(S$.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(S$.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:iG,operations:["max","min","values"]},{key:sG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new b$(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),dG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),dG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}S$.type=oB.circlePacking,S$.mark=xF,U(S$,f$);const A$=()=>{hz.registerSeries(S$.type,S$),CY(),nY(),XH(),hz.registerAnimation("circlePacking",((t,e)=>({appear:x$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},k$=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=k$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function M$(t){return t.depth}function T$(t,e){return e-1-t.endDepth}const w$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),C$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},E$={left:M$,right:T$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:M$,end:T$},P$=_t(0,1);class B${constructor(t){this._ascendingSourceBreadth=(t,e)=>w$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>w$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},B$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?hb(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):E$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};yb(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),yb(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];k$(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:Tt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),s[t.source].sourceLinks.push(a),s[t.target].targetLinks.push(a),n[r]=a})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[C$(s[t.source]),C$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=$(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=ft(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/s)}),1/0)}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,n,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*P$(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(w$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(w$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new B$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},L$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&L$(t,e.children,i)}))},O$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},I$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new B$(e),r=[];return r.push(n.layout(s,i)),r},D$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},F$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class j$ extends aN{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const z$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),H$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:z$(t),V$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class N$ extends zH{constructor(){super(...arguments),this.type=N$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}N$.type="linkPath";const G$=()=>{kR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(BO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),kR.registerAnimationType("linkPathGrowIn",RO),kR.registerAnimationType("linkPathGrowOut",LO),kR.registerAnimationType("linkPathUpdate",OO),_O(),pO(),hz.registerMark(N$.type,N$)};class W$ extends xG{constructor(){super(...arguments),this.type=oB.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Zt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[Jz.STATE_SANKEY_EMPHASIS,Jz.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(Y(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(Jz.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(Jz.STATE_SANKEY_EMPHASIS),e.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS)):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(Jz.STATE_SANKEY_EMPHASIS),s.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[Jz.STATE_SANKEY_EMPHASIS,Jz.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(Jz.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){Dz(this._dataSet,"sankeyLayout",I$),Dz(this._dataSet,"sankeyFormat",O$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:Xz.sankeyLayout});const{dataSet:a}=this._option;Dz(a,"sankeyNodes",D$),Dz(a,"flatten",d$);const o=new _a(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:rG.bind(this),call:aG}},!1),this._nodesSeriesData=new eG(this._option,o),Dz(a,"sankeyLinks",F$);const l=new _a(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:rG.bind(this),call:aG}},!1),this._linksSeriesData=new eG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(W$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(W$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(W$.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},Jz.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},Jz.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},Jz.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},Jz.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},Jz.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},Jz.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},Jz.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},Jz.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},Jz.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},Jz.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},Jz.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),dG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),dG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(cG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),dG("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([Jz.STATE_SANKEY_EMPHASIS_REVERSE,Jz.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new j$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new HF;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return L$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}W$.type=oB.sankey,W$.mark=mF;const U$=()=>{kR.registerTransform("sankey",{transform:R$,markPhase:"beforeJoin"},!0),wW(),G$(),nY(),hz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:H$(t,e)},KH))),hz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:V$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),$H(),hz.registerSeries(W$.type,W$)},Y$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=d$(n);return i=JN([{latestData:r}],e),i};class K$ extends aN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const X$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class $$ extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class q$ extends xG{constructor(){super(...arguments),this.type=oB.treemap,this.transformerConstructor=$$,this._viewBox=new Zt,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:sG),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ae),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:yD},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[sG,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(Dz(this._rawData.dataSet,"addVChartProperty",qN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:oG.bind(this),call:lG}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){Dz(this._dataSet,"hierarchyDimensionStatistics",Y$),Dz(this._dataSet,"flatten",d$);const i=new _a(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:iG,operations:["max","min","values"]},{key:sG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(q$.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(q$.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},Jz.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},Jz.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),dG(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new K$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}q$.type=oB.treemap,q$.mark=gF,q$.transformerConstructor=$$,U(q$,f$),U(q$,_U);const Z$=()=>{wW(),nY(),hz.registerAnimation("treemap",((t,e)=>({appear:X$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),$H(),kR.registerTransform("treemap",{transform:UX,markPhase:"beforeJoin"},!0),hz.registerSeries(q$.type,q$)},J$={type:"fadeIn"};function Q$(t,e){return"fadeIn"===e?J$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class tq extends vG{constructor(){super(...arguments),this._supportStack=!1}}class eq extends pK{constructor(){super(...arguments),this.type=oB.gaugePointer,this.transformerConstructor=tq,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(eq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},eq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(eq.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=$(e),n=ft(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),dG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}eq.type=oB.gaugePointer,eq.mark=vF,eq.transformerConstructor=tq;const iq=()=>{hz.registerSeries(eq.type,eq),uU(),wW(),hz.registerAnimation("gaugePointer",((t,e)=>{const i=Q$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),$Y(),KY()};class sq extends vG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class nq extends pK{constructor(){super(...arguments),this.type=oB.gauge,this.transformerConstructor=sq,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Qt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();Dz(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[OD]=t[this._angleField[0]],t[LD]=e>0?i[e-1][OD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(nq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(nq.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.min(e+this._padAngle/2,(e+i)/2)}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.max(i-this._padAngle/2,(e+i)/2)}_getAngleValueStartWithoutPadAngle(t){return p(t[LD])?this.angleAxisHelper.dataToPosition([t[LD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[OD]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),dG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}nq.type=oB.gauge,nq.mark=fF,nq.transformerConstructor=sq;class rq extends CG{constructor(){super(...arguments),this.type=rq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}rq.type="cell";const aq=()=>{hz.registerMark(rq.type,rq),fM(),_M(),kR.registerGraphic(RB.cell,yg),kR.registerMark(RB.cell,lD)};function oq(t){return!1===t?{}:{type:"fadeIn"}}class lq extends aN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class hq extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class cq extends xG{constructor(){super(...arguments),this.type=oB.heatmap,this.transformerConstructor=hq}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(cq.mark.cell,{morph:gG(this._spec,cq.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(cq.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ti(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=bG(this);this._cellMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),dG("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new lq(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}cq.type=oB.heatmap,cq.mark=SF,cq.transformerConstructor=hq;const dq=()=>{nY(),aq(),hz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KH),{appear:oq(e)}))),JG(),$G(),hz.registerSeries(cq.type,cq)},uq=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=Qt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=Qt(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=gb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=gb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+gb(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+gb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=hb(e.field),C=t.map(w),[E,P]=ub(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:hb(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==w?ub(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=pq(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),gq({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},gq=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[_D]:null==n?void 0:n[_D],[bD]:null==n?void 0:n[bD]}};class fq extends zH{constructor(){super(...arguments),this.type=fq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}fq.type="ripple";const vq=()=>{hz.registerMark(fq.type,fq),kR.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),_O(),fO()},_q=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class yq extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class bq extends vY{constructor(){super(...arguments),this.type=oB.correlation,this.transformerConstructor=yq,this._viewBox=new Zt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Dz(this._dataSet,"correlation",uq);const s=new fa;Fz(s,"dataview",pa),Dz(s,"correlationCenter",mq);const n=new _a(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new eG(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(bq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:_D,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(bq.mark.ripplePoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(bq.mark.centerPoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[gD],y:t=>t[mD],size:t=>t[fD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),dG("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}bq.type=oB.correlation,bq.mark=AF,bq.transformerConstructor=yq;const xq=()=>{PG(),vq(),hz.registerSeries(bq.type,bq),hz.registerAnimation("correlation",((t,e)=>Object.assign({appear:_q(0,e)},YH)))};class Sq extends zH{constructor(){super(...arguments),this.type=Sq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}Sq.type="liquid";const Aq=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e/2):t;class kq extends aN{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class Mq extends _G{constructor(){super(...arguments),this.type=oB.liquid,this.transformerConstructor=BG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=$F(this._spec.outlineMargin),this._paddingSpec=$F(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(t),this._heightRatio=It(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(Mq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Mq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(Mq.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return Aq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[yg({x:e,y:i,size:s,symbolType:Aq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new kq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),dG("liquid",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=DM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}Mq.type=oB.liquid,Mq.mark=MF,Mq.transformerConstructor=BG;const Tq=t=>Y(t).join(",");class wq extends aN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Tq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Tq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Cq extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Eq extends _G{constructor(){super(...arguments),this.type=oB.venn,this.transformerConstructor=Cq,this._viewBox=new Zt}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:yD)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(Eq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Eq.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},Jz.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},Jz.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Tq(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>Tq(t.sets)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new wq(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:Tq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Tq(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[Tq(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(Tq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),dG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),dG(t.name,this._spec,this._markAttributeContext)))}))}}Eq.type=oB.venn,Eq.mark=TF,Eq.transformerConstructor=Cq;class Pq extends lW{_isValidSeries(t){return t===oB.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class Bq extends aW{constructor(){super(...arguments),this.transformerConstructor=Pq,this.type="map",this.seriesType=oB.map}}Bq.type="map",Bq.seriesType=oB.map,Bq.transformerConstructor=Pq;class Rq extends lW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Lq extends Rq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=EV(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Tj({},s,l)),n&&Object.assign(o,Tj({},n,o))}}class Oq extends Rq{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Iq extends Rq{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle})}}class Dq extends aW{constructor(){super(...arguments),this.transformerConstructor=Iq}}Dq.transformerConstructor=Iq;class Fq extends Dq{constructor(){super(...arguments),this.transformerConstructor=Iq,this.type="pie",this.seriesType=oB.pie}}Fq.type="pie",Fq.seriesType=oB.pie,Fq.transformerConstructor=Iq;class jq extends Iq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class zq extends Dq{constructor(){super(...arguments),this.transformerConstructor=jq,this.type="pie3d",this.seriesType=oB.pie3d}}zq.type="pie3d",zq.seriesType=oB.pie3d,zq.transformerConstructor=jq;class Hq extends Oq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:EB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:EB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Vq extends aW{constructor(){super(...arguments),this.transformerConstructor=Hq,this.type="rose",this.seriesType=oB.rose,this._canStack=!0}}Vq.type="rose",Vq.seriesType=oB.rose,Vq.transformerConstructor=Hq;class Nq extends Oq{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Tj({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Gq extends aW{constructor(){super(...arguments),this.transformerConstructor=Nq,this.type="radar",this.seriesType=oB.radar,this._canStack=!0}}Gq.type="radar",Gq.seriesType=oB.radar,Gq.transformerConstructor=Nq;class Wq extends lW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&Tj(e,aH(this.type,t))})),this._transformAxisSpec(t)}}class Uq extends aW{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="common",this._canStack=!0}}Uq.type="common",Uq.transformerConstructor=Wq;class Yq extends hW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class Kq extends aW{constructor(){super(...arguments),this.transformerConstructor=Yq,this._canStack=!0}}Kq.transformerConstructor=Yq;class Xq extends Yq{transformSpec(t){super.transformSpec(t),sH(t)}}class $q extends Kq{constructor(){super(...arguments),this.transformerConstructor=Xq,this.type="histogram",this.seriesType=oB.bar}}$q.type="histogram",$q.seriesType=oB.bar,$q.transformerConstructor=Xq;class qq extends Kq{constructor(){super(...arguments),this.transformerConstructor=Xq,this.type="histogram3d",this.seriesType=oB.bar3d}}qq.type="histogram3d",qq.seriesType=oB.bar3d,qq.transformerConstructor=Xq;class Zq extends Lq{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class Jq extends aW{constructor(){super(...arguments),this.transformerConstructor=Zq,this.type="circularProgress",this.seriesType=oB.circularProgress,this._canStack=!0}}Jq.type="circularProgress",Jq.seriesType=oB.circularProgress,Jq.transformerConstructor=Zq;class Qq extends Lq{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:oB.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===oB.gauge||t.type===oB.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===oB.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class tZ extends aW{constructor(){super(...arguments),this.transformerConstructor=Qq,this.type="gauge",this.seriesType=oB.gaugePointer}}tZ.type="gauge",tZ.seriesType=oB.gaugePointer,tZ.transformerConstructor=Qq;class eZ extends lW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class iZ extends aW{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}iZ.transformerConstructor=eZ;class sZ extends eZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class nZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}nZ.type="wordCloud",nZ.seriesType=oB.wordCloud,nZ.transformerConstructor=sZ;class rZ extends eZ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class aZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=rZ,this.type="wordCloud3d",this.seriesType=oB.wordCloud3d}}aZ.type="wordCloud3d",aZ.seriesType=oB.wordCloud3d,aZ.transformerConstructor=rZ;class oZ extends lW{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class lZ extends aW{constructor(){super(...arguments),this.transformerConstructor=oZ,this.type="funnel",this.seriesType=oB.funnel}}lZ.type="funnel",lZ.seriesType=oB.funnel,lZ.transformerConstructor=oZ;class hZ extends aW{constructor(){super(...arguments),this.transformerConstructor=oZ,this.type="funnel3d",this.seriesType=oB.funnel3d}}hZ.type="funnel3d",hZ.seriesType=oB.funnel3d,hZ.transformerConstructor=oZ;class cZ extends hW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=EV(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=EV(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class dZ extends aW{constructor(){super(...arguments),this.transformerConstructor=cZ,this.type="linearProgress",this.seriesType=oB.linearProgress,this._canStack=!0}}dZ.type="linearProgress",dZ.seriesType=oB.linearProgress,dZ.transformerConstructor=cZ;class uZ extends hW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),sH(t)}}class pZ extends aW{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="rangeColumn",this.seriesType=oB.rangeColumn}}pZ.type="rangeColumn",pZ.seriesType=oB.rangeColumn,pZ.transformerConstructor=uZ;class gZ extends hW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class mZ extends aW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="rangeColumn3d",this.seriesType=oB.rangeColumn3d}}mZ.type="rangeColumn3d",mZ.seriesType=oB.rangeColumn3d,mZ.transformerConstructor=gZ;class fZ extends lW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:CB,i=p(t.endAngle)?t.endAngle:e+te(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=oB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vZ extends aW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="sunburst",this.seriesType=oB.sunburst}}vZ.type="sunburst",vZ.seriesType=oB.sunburst,vZ.transformerConstructor=fZ;class _Z extends lW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=oB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class yZ extends aW{constructor(){super(...arguments),this.transformerConstructor=_Z,this.type="circlePacking",this.seriesType=oB.circlePacking}}yZ.type="circlePacking",yZ.seriesType=oB.circlePacking,yZ.transformerConstructor=_Z;class bZ extends lW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class xZ extends aW{constructor(){super(...arguments),this.transformerConstructor=bZ,this.type="treemap",this.seriesType=oB.treemap}}xZ.type="treemap",xZ.seriesType=oB.treemap,xZ.transformerConstructor=bZ;class SZ extends LW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),sH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class AZ extends OW{constructor(){super(...arguments),this.transformerConstructor=SZ,this.type="waterfall",this.seriesType=oB.waterfall}}AZ.type="waterfall",AZ.seriesType=oB.waterfall,AZ.transformerConstructor=SZ;class kZ extends hW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),sH(t)}}class MZ extends aW{constructor(){super(...arguments),this.transformerConstructor=kZ,this.type="boxPlot",this.seriesType=oB.boxPlot}}MZ.type="boxPlot",MZ.seriesType=oB.boxPlot,MZ.transformerConstructor=kZ;class TZ extends lW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class wZ extends aW{constructor(){super(...arguments),this.transformerConstructor=TZ,this.type="sankey",this.seriesType=oB.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}wZ.type="sankey",wZ.seriesType=oB.sankey,wZ.transformerConstructor=TZ;class CZ extends hW{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),sH(t)}}class EZ extends aW{constructor(){super(...arguments),this.transformerConstructor=CZ,this.type="rangeArea",this.seriesType=oB.rangeArea}}EZ.type="rangeArea",EZ.seriesType=oB.rangeArea,EZ.transformerConstructor=CZ;class PZ extends hW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class BZ extends aW{constructor(){super(...arguments),this.transformerConstructor=PZ,this.type="heatmap",this.seriesType=oB.heatmap}}BZ.type="heatmap",BZ.seriesType=oB.heatmap,BZ.transformerConstructor=PZ;class RZ extends lW{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=oB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class LZ extends aW{constructor(){super(...arguments),this.transformerConstructor=RZ,this.type="correlation",this.seriesType=oB.correlation}}LZ.type="correlation",LZ.seriesType=oB.correlation,LZ.transformerConstructor=RZ;function OZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=lz(t.style)),B(t.textStyle)||Tj(s.textStyle,lz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&lz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&lz(s.background.style),s}const IZ=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},DZ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:bD;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class FZ extends DG{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=UF(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new DH(this._option,e),this._initSelectedData(),sB(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(sB(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(Tj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Tj({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(Tj({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}FZ.specKey="legends";class jZ extends FZ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),sB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Dz(this._option.dataSet,"discreteLegendFilter",DZ),Dz(this._option.dataSet,"discreteLegendDataMake",IZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return sB(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!nb(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=qj(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=OZ(s)),B(n.focusIconStyle)||lz(n.focusIconStyle),n.shape&&(n.shape=az(n.shape)),n.label&&(n.label=az(n.label)),n.value&&(n.value=az(n.value)),n.background&&(n.background=az(n.background)),YF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),YF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),YF(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||lz(r.railStyle),B(r.sliderStyle)||lz(r.sliderStyle)):(B(r.textStyle)||lz(r.textStyle),r.handler&&az(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Tj(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return uP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(rP.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(rP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rP.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=TV(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=TV(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}jZ.specKey="legends",jZ.type=r.discreteLegend;const zZ=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},HZ=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?rz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function VZ(t){return"color"===t||"size"===t}const NZ={color:vP,size:yP},GZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],WZ=[2,10];class UZ extends FZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return VZ(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{VZ(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),sB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Dz(this._option.dataSet,"continuousLegendFilter",HZ),Dz(this._option.dataSet,"continuousLegendDataMake",zZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>nB(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=qj(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!nb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=qj(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?GZ:WZ);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=Tj({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(w.title=OZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=lz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=lz(r.style)),B(a.style)||(w.trackStyle=lz(a.style)),w.startText=az(o),w.endText=az(l),w.handlerText=az(h),B(c)||(w.sizeBackground=lz(c)),d.visible&&!B(d.style)&&(Tj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return NZ[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}UZ.specKey="legends",UZ.type=r.continuousLegend;class YZ{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=Tz(n,a,!0))&&void 0!==e?e:[],...null!==(i=gz(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!jw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=sN(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=sN(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(uN(s).every((t=>{var e;return!sN(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=sN(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=cN(t,i,s),m=dN(t,i,s),f=Tj({},I(e[t]),m),v=g.title,_=gN(void 0,f,u.shape,void 0,v);p(f.title)?f.title=lN(f.title,Object.assign(Object.assign({},v),_)):f.title=lN(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=pN(y);f.content=hN(f.content,(e=>gN(e,f,u.shape,t)))}else f.content=hN(y,(t=>gN(void 0,f,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),f),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=xN(a,t,e),l=!!p(o)&&!1!==fN(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class KZ extends YZ{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class XZ extends YZ{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class $Z extends YZ{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:Y(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?Y(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const qZ=t=>p(t)&&!y(t),ZZ=t=>p(t)&&y(t);class JZ extends IG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=Tj({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=sN(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:tb(this._option.mode)||!Jy(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?_(t.parentElement)&&(t.parentElement=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Jy(this._option.mode)&&(t.parentElement=null==Zy?void 0:Zy.body)}}class QZ extends DG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=JZ,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=Jy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(!t&&this._clickLock)return;const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&qZ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&ZZ(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||(this._handleChartMouseOut(e),t&&this._clickLock&&(this._clickLock=!1))},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock&&(this._clickLock=!0));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sV.globalConfig.uniqueTooltip&&l&&sV.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?vN.canvas:vN.dom,n=hz.getComponentPluginInType(t);n||Xy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new XZ(this),dimension:new KZ(this),group:new $Z(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(Qy(i)||tb(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")&&(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0)))}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=eN(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(ZZ(t)){if(qZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>cz(t,e[i])))))return!1}else{if(ZZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&ii(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}QZ.type=r.tooltip,QZ.transformerConstructor=JZ,QZ.specKey="tooltip";var tJ,eJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(tJ||(tJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(eJ||(eJ={}));const iJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class sJ extends DG{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};y(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Qy(e)||tb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(y(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{iJ[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField||t.yField)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){mz(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{jw(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:fz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=rB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=jV(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=VV(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=NV(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new uT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new pT(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new QM(e)),null==s||s.add(t)),DV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}nJ.specKey="crosshair",nJ.type=r.cartesianCrosshair;class rJ extends sJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField||t.valueField)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{jw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:$t.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=rB(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",Tj(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=CV(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=CV(s.getSpec())),c.angle=a.angle,c.axis=s,Tj(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=TV(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=TV(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:ie(o,s,i),end:ie(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new uT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new mT(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ne(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},ie(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=se(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=ie(t,r,p),f=ie(t,r,g),v=Be([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=ft($t.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new fT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new gT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ne(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},ie(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new QM(e),null==s||s.add(t),i(t)),DV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}rJ.specKey="crosshair",rJ.type=r.polarCrosshair;const aJ=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},oJ=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class lJ extends DG{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=ft(this._start+g,0,1),v=ft(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Rt(s/n)>=.5:Rt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=_z(t),this._isHorizontal="horizontal"===yz(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Dw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(Dw(this._stateScale.type));this._stateScale.domain(e,!0),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};sB(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=Dw(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=Y(u.xField),g=Y(u.yField),m="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,f="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?m:f,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?m:f;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else sB(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;Fz(s,"dataview",pa),Dz(s,"dataFilterComputeDomain",oJ);const n=new _a(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new DH(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(Dw(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&Dw(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Dw(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Dw(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new rC,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(Dz(this._option.dataSet,"dataFilterWithNewDomain",aJ),sB(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>Dw(this._stateScale.type)},level:Xz.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Dw(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&jw(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,jw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(lJ,_U);class hJ extends IG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Tj({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class cJ extends lJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=hJ,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new TC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Dw(t.type)||e[0]!==e[1])&&(!jw(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new rE(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:lz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:lz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:lz(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:lz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:lz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:lz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:lz(g.style)},selectedBackgroundStyle:lz(this._spec.selectedBackground.style),dragMaskStyle:lz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Tj(lz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Tj(lz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=TV(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}cJ.type=r.dataZoom,cJ.transformerConstructor=hJ,cJ.specKey="dataZoom";class dJ extends lJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new EM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=$P(this._start,e)&&$P(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=lz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=lz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}dJ.type=r.scrollBar,dJ.specKey="scrollBar";const uJ=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class pJ extends DG{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==pJ.type)return null;const e=t[this.specKey];if(!y(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Dz(this._option.dataSet,"indicatorFilter",uJ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new DH(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return Y(this._spec.content).forEach((t=>{const e=Tj({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},lz(e.style)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?ZF(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ZF(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},lz(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new SP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}pJ.type=r.indicator,pJ.specKey="indicator";const gJ=["sum","average","min","max","variance","standardDeviation","median"];function mJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function fJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&mJ(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=YF(t.x)?bJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function vJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&mJ(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=YF(t.y)?bJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function _J(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&mJ(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function yJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&mJ(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function bJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function xJ(t){return gJ.includes(t)}function SJ(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=fJ(t,m,n,d,h,a),i=vJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=fJ(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=vJ(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function AJ(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=_J(t,l,n,r),i=yJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=_J(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=yJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function kJ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=YF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=YF(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&mJ(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&mJ(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function MJ(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&mJ(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&mJ(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function TJ(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return YF(e)&&(e=bJ(e,r)),e+=s,YF(i)&&(i=bJ(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return YF(e)&&(e=bJ(e,s)),YF(i)&&(i=bJ(i,n)),{x:e,y:i}}))}function wJ(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function CJ(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},lz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},PJ(lz(s.style),i)),p(s.padding)&&(t.padding=ti(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=PJ(lz(n),i)),t}return{visible:!1}}function EJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function PJ(t,e){return d(t)?t(e):t}function BJ(t,e){return d(t)?t(e):t}function RJ(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function LJ(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function OJ(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function IJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function DJ(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;y(i)?s.x=i.map((i=>jJ(i,t,e))):s.x=jJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>jJ(i,t,e))):s.y=jJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>jJ(i,t,e))):s.angle=jJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>jJ(i,t,e))):s.radius=jJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=jJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const FJ={min:(t,e)=>qP(t[0].latestData,e.field),max:(t,e)=>ZP(t[0].latestData,e.field),sum:function(t,e){return JP(t[0].latestData,e.field)},average:function(t,e){return QP(t[0].latestData,e.field)},variance:function(t,e){return tB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tB(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ht(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function jJ(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return FJ[i](e,{field:s})}return t}class zJ extends DG{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(B(e))return;if(!y(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return Y(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&xJ(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:Y(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=Y(s)[a]),r&&Y(s).includes(r)&&(h=r);let c=n;p(l)&&(c=Y(n)[l]),o&&Y(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),_(t[h])&&xJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&xJ(t[c])?i.y={field:c,aggrType:t[c]}:i.y=Y(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=Y(n)[a]),r&&Y(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),_(t[o])&&xJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&xJ(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=Y(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new fa;return e.registerParser("array",s),new _a(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=rB(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=KF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=KF(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function HJ(t,e){return function(t,e,i){const{predict:s}=vb(t,(t=>t[e]),(t=>t[i])),n=qP(t,e),r=ZP(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function VJ(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class NJ extends zJ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=LJ(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:PJ(lz(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:CJ(y,this._markerData),state:{line:EJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:EJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:EJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:EJ(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:EJ(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:lz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:lz(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=wJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=LJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Dz(this._option.dataSet,"markerAggregation",DJ),Dz(this._option.dataSet,"markerRegression",HJ),Dz(this._option.dataSet,"markerFilter",VJ);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new _a(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}NJ.specKey="markLine";class GJ extends NJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new UE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=LJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=SJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=kJ(i,r,d,e.coordinatesOffset):c&&(y=TJ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(YF(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=LJ(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}GJ.type=r.markLine,GJ.coordinateType="cartesian";class WJ extends NJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=LJ(this._spec);return e||i?new XE(t):new UE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=LJ(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=AJ(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>ie(m,t.radius,t.angle)))}}else u&&(p=MJ(i,r,a),g={points:p.map((t=>ie(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=LJ(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}WJ.type=r.polarMarkLine,WJ.coordinateType="polar";class UJ extends DG{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=UF(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!y(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new bP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}UJ.type=r.title,UJ.specKey=r.title;class YJ extends zJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=OJ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:PJ(lz(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:CJ(u,this._markerData),state:{area:EJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:EJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:EJ(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=wJ([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=OJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Dz(this._option.dataSet,"markerAggregation",DJ),Dz(this._option.dataSet,"markerFilter",VJ);const c=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}YJ.specKey="markArea";class KJ extends YJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new KE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=OJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=SJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=SJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=kJ(i,r,d,e.coordinatesOffset):c&&(u=TJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=OJ(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}KJ.type=r.markArea,KJ.coordinateType="cartesian";class XJ extends YJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=OJ(this._spec);return i||e||s?new $E(t):new KE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=OJ(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=AJ(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=MJ(i,r,c),u={points:d.map((t=>ie(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=OJ(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}XJ.type=r.polarMarkArea,XJ.coordinateType="polar";const $J=t=>lz(Object.assign({},t)),qJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},lz(t.style))}),ZJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=$J(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=$J(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},lz(Object.assign({},y)));var y;const b=qJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=qJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=qJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=qJ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},JJ=t=>"left"===t||"right"===t,QJ=t=>"top"===t||"bottom"===t;class tQ extends DG{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},ZJ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},ZJ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new DP(t):this._playerComponent=new zP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=JJ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=JJ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(PP.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(PP.change,(e=>{const{index:i}=e.detail,s=this._specs[i];Y(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(PP.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(PP.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(PP.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(PP.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=JJ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=QJ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):JJ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):QJ(this._orient)?this._maxSize():t.height}_computeDx(t){return JJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return QJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}tQ.specKey="player",tQ.type=r.player;class eQ extends DG{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}eQ.type=r.label;class iQ extends sY{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}iQ.type="text",iQ.constructorType="label";const sQ=()=>{hz.registerMark(iQ.constructorType,iQ),vO()};class nQ extends IG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class rQ extends eQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=nQ,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),sB(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=Tj({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=jU[t])&&void 0!==i?i:jU.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:zU(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=y(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}rQ.type=r.label,rQ.specKey="label",rQ.transformerConstructor=nQ;class aQ extends eQ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[PD]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return Tj({textStyle:{pickable:!0===this._spec.interactive},position:oQ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[RD]))},a))}})).encode((e=>zU({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function oQ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}aQ.type=r.totalLabel,aQ.specKey="totalLabel";class lQ extends zJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=IJ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,A,k,M,T,w,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:BJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:BJ(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:PJ(B.style,this._markerData)},state:{line:EJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:EJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:EJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:EJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:EJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:EJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:EJ(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:EJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:EJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:EJ(null!==(w=null===(T=this._spec.targetSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=lz(PJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=PJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=CJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=PJ(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:lz(z.style)}):{visible:!1};return new ZE(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=wJ([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:RJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:RJ(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=IJ(t);if(!(p(t.coordinate)||e||i||s))return;Dz(this._option.dataSet,"markerAggregation",DJ),Dz(this._option.dataSet,"markerFilter",VJ);const{options:n}=this._computeOptions(),r=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}lQ.specKey="markPoint";class hQ extends lQ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=SJ(i,s,s,s,o)[0][0]:r?l=kJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=TJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=IJ(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}hQ.type=r.markPoint,hQ.coordinateType="cartesian";class cQ extends lQ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=AJ(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:ie({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}cQ.type=r.polarMarkPoint,cQ.coordinateType="polar";class dQ extends lQ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}dQ.type=r.geoMarkPoint,dQ.coordinateType="geo";const uQ="inBrush",pQ="outOfBrush";class gQ extends DG{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),uQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),pQ,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new GP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:lz(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(FP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,pQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(FP.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(FP.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},lz(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(uQ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(uQ),i.addState(pQ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(uQ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(uQ),i.addState(pQ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],qe(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],qe(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(uQ),i.removeState(pQ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}gQ.type=r.brush,gQ.specKey="brush";class mQ extends DG{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?y(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${hB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=cG({},dG(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Zt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Zt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}mQ.type=r.customMark,mQ.specKey="customMark";function fQ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function vQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function _Q(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:vQ(t.rect),anchorCandidates:kQ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>fQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tfQ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function yQ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=We(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=SQ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=hi(r,s,i);if(!SQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],bQ(xQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=bQ(xQ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=AQ(t.rect,a,0),t}));return _Q(h)}function bQ(t){return t>180?t-360:t}function xQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function SQ(t,e){for(let i=0;i{const{x:r,y:a}=AQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class MQ extends DG{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new _a(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:Xz.copyDataView},!1),this._data=new DH(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new ZE({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=$F(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),T=Au({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Mg(lz(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,T.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=yg(lz(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,T.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=gp(lz(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=gp(lz(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,T.appendChild(e),y=Math.max(y,s),_+=n,m++}const w=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==w?void 0:w.getComputedAttribute("x"),y:null==w?void 0:w.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*A,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=AQ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:lz(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):_Q(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}MQ.type=r.mapLabel,MQ.specKey="mapLabel";class TQ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>wQ(t))),a=n.filter((t=>!wQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>wQ(t))),h=o.filter((t=>!wQ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function wQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}TQ.type="grid";sV.useRegisters([()=>{iI(),sI(),wG(),PG(),ZH(),XH(),JG(),$G(),hz.registerSeries(iW.type,iW),hz.registerChart(dW.type,dW)},()=>{iI(),sI(),wG(),pW(),PG(),mW(),JG(),$G(),hz.registerSeries(vW.type,vW),hz.registerChart(yW.type,yW)},()=>{RW(),hz.registerChart(OW.type,OW)},()=>{KW(),hz.registerChart($W.type,$W)},()=>{RY(),hz.registerChart(Fq.type,Fq)},()=>{ZY(),hz.registerChart(Vq.type,Vq)},()=>{rK(),hz.registerChart(Gq.type,Gq)},()=>{RW(),hz.registerChart($q.type,$q)},()=>{kU(),hz.registerChart(Bq.type,Bq)},()=>{iq(),hz.registerSeries(nq.type,nq),CY(),fK(),KY(),hz.registerChart(tZ.type,tZ)},()=>{rX(),hz.registerChart(nZ.type,nZ)},()=>{MX(),hz.registerChart(lZ.type,lZ)},()=>{$U(),hz.registerChart(AZ.type,AZ)},()=>{eY(),PG(),XH(),JG(),$G(),hz.registerSeries(iY.type,iY),hz.registerChart(MZ.type,MZ)},()=>{hz.registerSeries(_K.type,_K),CY(),fK(),$H(),$Y(),KY(),hz.registerChart(Jq.type,Jq)},()=>{MK(),hz.registerChart(dZ.type,dZ)},()=>{pY(),hz.registerChart(pZ.type,pZ)},()=>{pW(),JG(),$G(),hz.registerSeries(fY.type,fY),hz.registerChart(EZ.type,EZ)},()=>{_$(),hz.registerChart(vZ.type,vZ)},()=>{A$(),hz.registerChart(yZ.type,yZ)},()=>{Z$(),hz.registerChart(xZ.type,xZ)},()=>{U$(),hz.registerChart(wZ.type,wZ)},()=>{dq(),hz.registerChart(BZ.type,BZ)},()=>{xq(),hz.registerChart(LZ.type,LZ)},()=>{hz.registerChart(Uq.type,Uq)},$G,JG,()=>{VG(),hz.registerComponent(QG.type,QG)},()=>{VG(),hz.registerComponent(tW.type,tW)},()=>{VG(),hz.registerComponent(eW.type,eW)},$Y,KY,()=>{hz.registerComponent(jZ.type,jZ)},()=>{hz.registerComponent(UZ.type,UZ)},()=>{hz.registerComponent(QZ.type,QZ)},()=>{hz.registerComponent(nJ.type,nJ)},()=>{hz.registerComponent(rJ.type,rJ)},()=>{hz.registerComponent(cJ.type,cJ)},()=>{hz.registerComponent(dJ.type,dJ)},()=>{hz.registerComponent(pJ.type,pJ)},xU,()=>{hz.registerComponent(GJ.type,GJ),WE()},()=>{hz.registerComponent(KJ.type,KJ),YE()},()=>{hz.registerComponent(hQ.type,hQ),qE()},()=>{hz.registerComponent(WJ.type,WJ),XE._animate=TE,WE()},()=>{hz.registerComponent(XJ.type,XJ),$E._animate=CE,YE()},()=>{hz.registerComponent(cQ.type,cQ),qE()},()=>{hz.registerComponent(dQ.type,dQ),qE()},()=>{hz.registerComponent(UJ.type,UJ)},()=>{hz.registerComponent(tQ.type,tQ)},()=>{zO(),sQ(),jG(),hz.registerComponent(rQ.type,rQ,!0)},()=>{zO(),sQ(),jG(),hz.registerComponent(aQ.type,aQ,!0)},()=>{hz.registerComponent(gQ.type,gQ)},()=>{hz.registerComponent(mQ.type,mQ)},()=>{hz.registerComponent(MQ.type,MQ)},()=>{$l.load(cT)},()=>{hz.registerLayout(TQ.type,TQ)},$N,UR,WR]),sV.useRegisters([()=>{TA($l)}]),t.ARC_END_ANGLE=xB,t.ARC_K=SB,t.ARC_MIDDLE_ANGLE=AB,t.ARC_QUADRANT=kB,t.ARC_RADIAN=MB,t.ARC_RATIO=yB,t.ARC_START_ANGLE=bB,t.ARC_TRANSFORM_VALUE=_B,t.AxisSyncPlugin=bV,t.BASE_EVENTS=hD,t.CORRELATION_SIZE=fD,t.CORRELATION_X=gD,t.CORRELATION_Y=mD,t.CanvasTooltipHandler=XN,t.DEFAULT_CHART_HEIGHT=dB,t.DEFAULT_CHART_WIDTH=cB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=HD,t.DEFAULT_DATA_INDEX=_D,t.DEFAULT_DATA_KEY=yD,t.DEFAULT_DATA_SERIES_FIELD=bD,t.DEFAULT_GRADIENT_CONFIG=VD,t.DEFAULT_LABEL_ALIGN=pB,t.DEFAULT_LABEL_LIMIT=uB,t.DEFAULT_LABEL_TEXT=gB,t.DEFAULT_LABEL_VISIBLE=mB,t.DEFAULT_LABEL_X=fB,t.DEFAULT_LABEL_Y=vB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=jD,t.DEFAULT_MEASURE_CANVAS_ID=vD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=zD,t.DEFAULT_SERIES_STYLE_NAME=xD,t.DomTooltipHandler=KN,t.Factory=hz,t.FormatterPlugin=uV,t.GradientType=FD,t.MediaQuery=lV,t.POLAR_DEFAULT_RADIUS=EB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=wB,t.POLAR_START_ANGLE=CB,t.POLAR_START_RADIAN=TB,t.PREFIX=hB,t.SEGMENT_FIELD_END=OD,t.SEGMENT_FIELD_START=LD,t.STACK_FIELD_END=MD,t.STACK_FIELD_END_OffsetSilhouette=ED,t.STACK_FIELD_END_PERCENT=wD,t.STACK_FIELD_KEY=AD,t.STACK_FIELD_START=kD,t.STACK_FIELD_START_OffsetSilhouette=CD,t.STACK_FIELD_START_PERCENT=TD,t.STACK_FIELD_TOTAL=PD,t.STACK_FIELD_TOTAL_PERCENT=BD,t.STACK_FIELD_TOTAL_TOP=RD,t.ThemeManager=Wj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=sV,t.WaterfallDefaultSeriesField=pD,t.builtinThemes=Lj,t.computeActualDataScheme=LF,t.darkTheme=yj,t.dataScheme=JF,t.default=sV,t.defaultThemeName=Oj,t.getActualColor=IF,t.getColorSchemeBySeries=zF,t.getDataScheme=RF,t.getMergedTheme=Nj,t.getTheme=zj,t.hasThemeMerged=Fj,t.isColorKey=DF,t.isProgressiveDataColorScheme=FF,t.isTokenKey=fj,t.lightTheme=_j,t.queryColorFromColorScheme=OF,t.queryToken=mj,t.registerCanvasTooltipHandler=$N,t.registerChartPlugin=oV,t.registerDomTooltipHandler=()=>{YN(KN)},t.registerFormatPlugin=()=>{oV(uV)},t.registerMediaQuery=()=>{oV(lV)},t.registerTheme=jj,t.removeTheme=Hj,t.themeExist=Vj,t.themes=Ij,t.token=vj,t.transformColorSchemeToStandardStruct=jF,t.version="1.11.5",t.vglobal=E_,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var T=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const C=Object.prototype.hasOwnProperty;function E(t){if(u(t))return!0;if(b(t))return!t.length;const e=M(t);if("Map"===e||"Set"===e)return!t.size;if(T(t))return!Object.keys(t).length;for(const e in t)if(C.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;e2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]?L(t,e,r,i):O(t,r,s[r])}}}}function L(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(_(r)){if(s)a=[];else if(_(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function F(t){return Object.prototype.toString.call(t)}function j(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(F(t)!==F(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let 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=j(t),n=j(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 H(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},U=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function K(t){return Number(t)}const X="undefined"!=typeof console;function $(t,e,i){const s=[e].concat([].slice.call(i));X&&console[t].apply(console,s)}var q;!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"}(q||(q={}));let Z=class t{static getInstance(e,i){return t._instance&&S(e)?t._instance.level(e):t._instance||(t._instance=new t(e,i)),t._instance}static setInstance(e){return t._instance=e}static setInstanceLevel(e){t._instance?t._instance.level(e):t._instance=new t(e)}static clearInstance(){t._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=q.Info}canLogDebug(){return this._level>=q.Debug}canLogError(){return this._level>=q.Error}canLogWarn(){return this._level>=q.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=q.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):$(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=q.Warn&&$(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=q.Info&&$(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=q.Debug&&$(this._method||"log","DEBUG",e),this}};function J(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;Y(t[n],e)>0?s=n:i=n+1}return i}Z._instance=null;const Q=(t,e)=>tt(0,t.length,(i=>e(t[i]))),tt=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},et=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Y)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:K;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},it=1e-10,st=1e-10;function nt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:it,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function rt(t,e,i,s){return t>e&&!nt(t,e,i,s)}function at(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var lt=function(t,e,i){return ti?i:t};function ht(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let ct=!1;try{ct="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){ct=!1}function dt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&ct;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 y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function gt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}ct=!1;const ft=Math.abs,mt=Math.max,vt=Math.sqrt,yt=Math.pow;function _t(t,e){return t[0]*e[1]-t[1]*e[0]}function bt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function xt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function St(t,e){return bt(t+e,10**Math.max(xt(t),xt(e)))}function At(t,e){return bt(t-e,10**Math.max(xt(t),xt(e)))}let kt=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new t(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}},Mt=class{static distancePP(t,e){return vt(yt(t.x-e.x,2)+yt(t.y-e.y,2))}static distanceNN(t,e,i,s){return vt(yt(t-i,2)+yt(e-s,2))}static distancePN(t,e,i){return vt(yt(e-t.x,2)+yt(i-t.y,2))}static pointAtPP(t,e,i){return new kt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}};let wt=class t{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new t(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return function(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f)):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f))}(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]}};function Tt(t){return t*(Math.PI/180)}function Ct(t){return 180*t/Math.PI}function Et(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 Pt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Bt(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=Pt(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/i)):h.push(Math.abs(r/i)),i>0?h.push(Math.abs((o-n)/e)):h.push(Math.abs(n/e)))})),Math.min.apply(null,h)}let Rt=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const e=this.a,i=this.b,s=this.c,n=this.d,r=this.e,a=this.f,o=new t,l=e*n-i*s;return o.a=n/l,o.b=-i/l,o.c=-s/l,o.d=e/l,o.e=(s*a-n*r)/l,o.f=-(e*a-i*r)/l,o}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(e,i){const s=new t;return s.a=this.a+(e.a-this.a)*i,s.b=this.b+(e.b-this.b)*i,s.c=this.c+(e.c-this.c)*i,s.d=this.d+(e.d-this.d)*i,s.e=this.e+(e.e-this.e)*i,s.f=this.f+(e.f-this.f)*i,s}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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new t(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,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=Ct(r.rotateDeg),r}};function Lt(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 Ot(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 It=/^#([0-9a-f]{3,8})$/,Dt={transparent:4294967040},Ft={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 jt(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function zt(t){return S(t)?new Gt(t>>16,t>>8&255,255&t,1):_(t)?new Gt(t[0],t[1],t[2]):new Gt(255,255,255)}function Ht(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Nt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Vt=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const s=e instanceof t?e:new t(e);switch(i){case"hsv":default:return s.getHSVBrightness();case"hsl":return s.getHSLBrightness();case"lum":return s.getLuminance();case"lum2":return s.getLuminance2();case"lum3":return s.getLuminance3()}}static parseColorString(t){if(p(Dt[t]))return function(t){return S(t)?new Gt(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new Gt(t[0],t[1],t[2],t[3]):new Gt(255,255,255,1)}(Dt[t]);if(p(Ft[t]))return zt(Ft[t]);const e=`${t}`.trim().toLowerCase(),i=It.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Gt((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?zt(t):8===e?new Gt(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Gt(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=Lt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Gt(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new Gt(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=Ot(this.color.r,this.color.g,this.color.b),r=Lt(u(t)?n.h:lt(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 Gt(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=It.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new Gt((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?zt(s):8===n?new Gt(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=Ft[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new t(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ht(t.color.r),this.color.g=Ht(t.color.g),this.color.b=Ht(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Nt(t.color.r),this.color.g=Nt(t.color.g),this.color.b=Nt(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}},Gt=class{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`#${jt(this.r)+jt(this.g)+jt(this.b)+(1===this.opacity?"":jt(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}=Ot(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}};var Wt=Object.freeze({__proto__:null,Color:Vt,DEFAULT_COLORS:Ft,RGB:Gt,hexToRgb:function(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 Gt(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:Ot});function Ut(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let Yt,Kt,Xt,$t;function qt(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}var Jt;function Qt(t,e,i){return!e||(i?(Yt=e.x1,Kt=e.x2,Xt=e.y1,$t=e.y2,Yt>Kt&&([Yt,Kt]=[Kt,Yt]),Xt>$t&&([Xt,$t]=[$t,Xt]),t.x>=Yt&&t.x<=Kt&&t.y>=Xt&&t.y<=$t):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}let te,ee,ie,se;function ne(t){return te=1/0,ee=1/0,ie=-1/0,se=-1/0,t.forEach((t=>{te>t.x&&(te=t.x),iet.y&&(ee=t.y),see&&r>s||rn?o:0}function he(t,e){return Math.abs(t-e)0&&ae(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}function de(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(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 ue(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}function pe(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}var ge=6371008.8,fe={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ge,kilometers:6371.0088,kilometres:6371.0088,meters:ge,metres:ge,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ge/1852,radians:1,yards:6967335.223679999};function me(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 ve(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ye(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===Qt(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function _e(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=Tt(t[0]),r=Tt(t[1]),a=Tt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=fe[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Ct(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Ct(l)}}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 Se;function Ae(t,e){const i=xe(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 ke{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Me=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function we(t){let e;if(e=Me.exec(t))return new ke({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]});Z.getInstance().error("invalid format: "+t)}const Te=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ce{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 Ce.instance||(Ce.instance=new Ce),Ce.instance}newFormat(t){const e=we(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"):Ee[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=Ee[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,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?Te[8+Se/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let M=S.length+k.length+A.length,w=M>1)+S+k+A+w.slice(M);break;default:k=w+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=we(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=xe(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Te[8+n/3];return function(t){return s(r*t)+a}}}const Ee={"%":(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)=>Ae(100*t,e),r:Ae,s:function(t,e){const i=xe(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(Se=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")+xe(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 Pe(){return new Be}function Be(){this.reset()}Be.prototype={constructor:Be,reset:function(){this.s=this.t=0},add:function(t){Le(Re,t,this.t),Le(this,Re.s,this.s),this.s?this.t+=Re.t:this.s=Re.t},valueOf:function(){return this.s}};var Re=new Be;function Le(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Oe=1e-6,Ie=Math.PI,De=Ie/2,Fe=Ie/4,je=2*Ie,ze=180/Ie,He=Ie/180,Ne=Math.abs,Ve=Math.atan,Ge=Math.atan2,We=Math.cos,Ue=Math.exp,Ye=Math.log,Ke=Math.pow,Xe=Math.sin,$e=Math.sign||function(t){return t>0?1:t<0?-1:0},qe=Math.sqrt,Ze=Math.tan;function Je(t){return t>1?0:t<-1?Ie:Math.acos(t)}function Qe(t){return t>1?De:t<-1?-De:Math.asin(t)}function ti(){}function ei(t,e){t&&si.hasOwnProperty(t.type)&&si[t.type](t,e)}var ii={Feature:function(t,e){ei(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sIe?t+Math.round(-t/je)*je:t,e]}function mi(t,e,i){return(t%=je)?e||i?gi(yi(t),_i(e,i)):yi(t):e||i?_i(e,i):fi}function vi(t){return function(e,i){return[(e+=t)>Ie?e-je:e<-Ie?e+je:e,i]}}function yi(t){var e=vi(t);return e.invert=vi(-t),e}function _i(t,e){var i=We(t),s=Xe(t),n=We(e),r=Xe(e);function a(t,e){var a=We(e),o=We(t)*a,l=Xe(t)*a,h=Xe(e),c=h*i+o*s;return[Ge(l*n-c*r,o*i-h*s),Qe(c*n+l*r)]}return a.invert=function(t,e){var a=We(e),o=We(t)*a,l=Xe(t)*a,h=Xe(e),c=h*n-l*r;return[Ge(l*n+h*r,o*i+c*s),Qe(c*i-o*s)]},a}function bi(t,e){(e=li(e))[0]-=t,pi(e);var i=Je(-e[1]);return((-e[2]<0?-i:i)+je-Oe)%je}function xi(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ti,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Si(t,e){return Ne(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 Mi(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Bi(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 Ri(t,e,i,s){return function(n){var r,a,o,l=e(n),h=xi(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Bi(a);var t=function(t,e){var i=Ei(e),s=e[1],n=Xe(s),r=[Xe(i),-We(i),0],a=0,o=0;Ci.reset(),1===n?s=De+Oe:-1===n&&(s=-De-Oe);for(var l=0,h=t.length;l=0?1:-1,M=k*A,w=M>Ie,T=f*x;if(Ci.add(Ge(T*k*Xe(M),m*S+T*We(M))),a+=w?A+k*je:A,w^p>=i^_>=i){var C=ci(li(u),li(y));pi(C);var E=ci(r,C);pi(E);var P=(w^A>=0?-1:1)*Qe(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^A>=0?1:-1)}}return(a<-Oe||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(Li))}return u}}function Li(t){return t.length>1}function Oi(t,e){return((t=t.x)[0]<0?t[1]-De-Oe:De-t[1])-((e=e.x)[0]<0?e[1]-De-Oe:De-e[1])}1===(wi=Pi).length&&(Ti=wi,wi=function(t,e){return Pi(Ti(t),e)});var Ii=Ri((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?Ie:-Ie,l=Ne(r-i);Ne(l-Ie)0?De:-De),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ie&&(Ne(i-n)Oe?Ve((Xe(e)*(r=We(s))*Xe(i)-Xe(s)*(n=We(e))*Xe(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*De,s.point(-Ie,n),s.point(0,n),s.point(Ie,n),s.point(Ie,0),s.point(Ie,-n),s.point(0,-n),s.point(-Ie,-n),s.point(-Ie,0),s.point(-Ie,n);else if(Ne(t[0]-e[0])>Oe){var r=t[0]0,n=Ne(e)>Oe;function r(t,i){return We(t)*We(i)>e}function a(t,i,s){var n=[1,0,0],r=ci(li(t),li(i)),a=hi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ci(n,r),u=ui(n,h);di(u,ui(r,c));var p=d,g=hi(u,p),f=hi(p,p),m=g*g-f*(hi(u,u)-1);if(!(m<0)){var v=qe(m),y=ui(p,(-g-v)/f);if(di(y,u),y=oi(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Ne(y[0]-b)Ie^(b<=y[0]&&y[0]<=x)){var w=ui(p,(-g+v)/f);return di(w,u),[y,oi(w)]}}}function o(e,i){var n=s?t:Ie-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ri(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?Ie:-Ie),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Si(e,p)||Si(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&&Si(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=We(e),o=Xe(e),l=s*i;null==n?(n=e+s*je,r=e-l/2):(n=bi(a,n),r=bi(a,r),(s>0?nr)&&(n+=s*je));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 Ne(s[0]-t)0?0:3:Ne(s[0]-i)0?2:1:Ne(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=xi(),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&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!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=y&&e,n=(l=Bi(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ki(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){n(t,e)&&_.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&&(_.lineStart(),_.point(r,a));else if(o&&m)_.point(r,a);else{var l=[g=Math.max(ji,Math.min(Fi,g)),f=Math.max(ji,Math.min(Fi,f))],b=[r=Math.max(ji,Math.min(Fi,r)),a=Math.max(ji,Math.min(Fi,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&&(_.lineStart(),_.point(r,a),y=!1):(m||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,m=o}return x}}function Hi(t){return t}var Ni,Vi,Gi,Wi,Ui=Pe(),Yi=Pe(),Ki={point:ti,lineStart:ti,lineEnd:ti,polygonStart:function(){Ki.lineStart=Xi,Ki.lineEnd=Zi},polygonEnd:function(){Ki.lineStart=Ki.lineEnd=Ki.point=ti,Ui.add(Ne(Yi)),Yi.reset()},result:function(){var t=Ui/2;return Ui.reset(),t}};function Xi(){Ki.point=$i}function $i(t,e){Ki.point=qi,Ni=Gi=t,Vi=Wi=e}function qi(t,e){Yi.add(Wi*t-Gi*e),Gi=t,Wi=e}function Zi(){qi(Ni,Vi)}var Ji=Ki,Qi=1/0,ts=Qi,es=-Qi,is=es;var ss,ns,rs,as,os={point:function(t,e){tes&&(es=t);eis&&(is=e)},lineStart:ti,lineEnd:ti,polygonStart:ti,polygonEnd:ti,result:function(){var t=[[Qi,ts],[es,is]];return es=is=-(ts=Qi=1/0),t}},ls=0,hs=0,cs=0,ds=0,us=0,ps=0,gs=0,fs=0,ms=0,vs={point:ys,lineStart:_s,lineEnd:Ss,polygonStart:function(){vs.lineStart=As,vs.lineEnd=ks},polygonEnd:function(){vs.point=ys,vs.lineStart=_s,vs.lineEnd=Ss},result:function(){var t=ms?[gs/ms,fs/ms]:ps?[ds/ps,us/ps]:cs?[ls/cs,hs/cs]:[NaN,NaN];return ls=hs=cs=ds=us=ps=gs=fs=ms=0,t}};function ys(t,e){ls+=t,hs+=e,++cs}function _s(){vs.point=bs}function bs(t,e){vs.point=xs,ys(rs=t,as=e)}function xs(t,e){var i=t-rs,s=e-as,n=qe(i*i+s*s);ds+=n*(rs+t)/2,us+=n*(as+e)/2,ps+=n,ys(rs=t,as=e)}function Ss(){vs.point=ys}function As(){vs.point=Ms}function ks(){ws(ss,ns)}function Ms(t,e){vs.point=ws,ys(ss=rs=t,ns=as=e)}function ws(t,e){var i=t-rs,s=e-as,n=qe(i*i+s*s);ds+=n*(rs+t)/2,us+=n*(as+e)/2,ps+=n,gs+=(n=as*t-rs*e)*(rs+t),fs+=n*(as+e),ms+=3*n,ys(rs=t,as=e)}var Ts=vs;function Cs(t){this._context=t}Cs.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,je)}},result:ti};var Es,Ps,Bs,Rs,Ls,Os=Pe(),Is={point:ti,lineStart:function(){Is.point=Ds},lineEnd:function(){Es&&Fs(Ps,Bs),Is.point=ti},polygonStart:function(){Es=!0},polygonEnd:function(){Es=null},result:function(){var t=+Os;return Os.reset(),t}};function Ds(t,e){Is.point=Fs,Ps=Rs=t,Bs=Ls=e}function Fs(t,e){Rs-=t,Ls-=e,Os.add(qe(Rs*Rs+Ls*Ls)),Rs=t,Ls=e}var js=Is;function zs(){this._string=[]}function Hs(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ns(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ai(t,i(s))),s.result()}return r.area=function(t){return ai(t,i(Ji)),Ji.result()},r.measure=function(t){return ai(t,i(js)),js.result()},r.bounds=function(t){return ai(t,i(os)),os.result()},r.centroid=function(t){return ai(t,i(Ts)),Ts.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Hi):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new zs):new Cs(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 Vs(t){return function(e){var i=new Gs;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Gs(){}function Ws(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ai(i,t.stream(os)),e(os.result()),null!=s&&t.clipExtent(s),t}function Us(t,e,i){return Ws(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 Ys(t,e,i){return Us(t,[[0,0],e],i)}function Ks(t,e,i){return Ws(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 Xs(t,e,i){return Ws(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)}zs.prototype={_radius:4.5,_circle:Hs(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=Hs(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}},Gs.prototype={constructor:Gs,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 $s=16,qs=We(30*He);function Zs(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,y=c-n,_=v*v+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=qe(b*b+x*x+S*S),k=Qe(S/=A),M=Ne(Ne(S)-1)e||Ne((v*E+y*P)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*He:0,E()):[m*ze,v*ze,y*ze]},T.angle=function(t){return arguments.length?(_=t%360*He,E()):_*ze},T.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},T.precision=function(t){return arguments.length?(a=Zs(o,w=t*t),P()):qe(w)},T.fitExtent=function(t,e){return Us(T,t,e)},T.fitSize=function(t,e){return Ys(T,t,e)},T.fitWidth=function(t,e){return Ks(T,t,e)},T.fitHeight=function(t,e){return Xs(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,E()}}function nn(t){var e=0,i=Ie/3,s=sn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*He,i=t[1]*He):[e*ze,i*ze]},n}function rn(t,e){var i=Xe(t),s=(i+Xe(e))/2;if(Ne(s)2?t[2]*He:0),e.invert=function(e){return(e=t.invert(e[0]*He,e[1]*He))[0]*=ze,e[1]*=ze,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===un?[[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 gn(t){return Ze((De+t)/2)}function fn(t,e){var i=We(t),s=t===e?Xe(t):Ye(i/We(e))/Ye(gn(e)/gn(t)),n=i*Ke(gn(t),s)/s;if(!s)return un;function r(t,e){n>0?e<-De+Oe&&(e=-De+Oe):e>De-Oe&&(e=De-Oe);var i=n/Ke(gn(e),s);return[i*Xe(s*t),n-i*We(s*t)]}return r.invert=function(t,e){var i=n-e,r=$e(s)*qe(t*t+i*i),a=Ge(t,Ne(i))*$e(i);return i*s<0&&(a-=Ie*$e(t)*$e(i)),[a/s,2*Ve(Ke(n/r,1/s))-De]},r}function mn(t,e){return[t,e]}function vn(t,e){var i=We(t),s=t===e?Xe(t):(i-We(e))/(e-t),n=i/s+t;if(Ne(s)Oe&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},wn.invert=hn(Qe),Tn.invert=hn((function(t){return 2*Ve(t)})),Cn.invert=function(t,e){return[-e,2*Ve(Ue(t))-De]};var Bn={exports:{}},Rn=function(t,e){this.p1=t,this.p2=e};Rn.prototype.rise=function(){return this.p2[1]-this.p1[1]},Rn.prototype.run=function(){return this.p2[0]-this.p1[0]},Rn.prototype.slope=function(){return this.rise()/this.run()},Rn.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Rn.prototype.isVertical=function(){return!isFinite(this.slope())},Rn.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Rn.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Rn.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Rn.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)},Rn.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ln=Rn,On=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ln(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=On(t.slice(0,s),e),o=On(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},In=On;!function(t){var e=In;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Fn(Hn,e),{tolerance:s}=i;return Dn(t,s)};var Vn;!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"}(Vn||(Vn={}));const Gn=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Xn(e,6):Xn(e,4))+"-"+Xn(t.getUTCMonth()+1,2)+"-"+Xn(t.getUTCDate(),2)+(r?"T"+Xn(i,2)+":"+Xn(s,2)+":"+Xn(n,2)+"."+Xn(r,3)+"Z":n?"T"+Xn(i,2)+":"+Xn(s,2)+":"+Xn(n,2)+"Z":s||i?"T"+Xn(i,2)+":"+Xn(s,2)+"Z":"")}function qn(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 Un;if(h)return h=!1,Wn;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 or(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=tr(t));var r=[];switch(t.type){case"GeometryCollection":return lr(t,(function(t){cr(t,s)})),t;case"FeatureCollection":return or(t,(function(t){or(cr(t,s),(function(t){r.push(t)}))})),ve(r)}return cr(t,s)}function cr(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return lr(t,(function(t){cr(t,e)})),t;case"LineString":return dr(rr(t),e),t;case"Polygon":return ur(rr(t),e),t;case"MultiLineString":return rr(t).forEach((function(t){dr(t,e)})),t;case"MultiPolygon":return rr(t).forEach((function(t){ur(t,e)})),t;case"Point":case"MultiPoint":return t}}function dr(t,e){ar(t)===e&&t.reverse()}function ur(t,e){ar(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=pr(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},vr=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Vn.GEO;const i=Fn(fr,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(mr(t))})):e.push(mr(t))})),e})(t);let o=t.features;return a&&(o=hr(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=gr.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=gr.bounds(t);t.bbox=e}})),t.features=o,t},yr={},_r=(t,e,i)=>{i.type=Vn.GEO;const s=Fn(fr,yr,e),{object:n}=s;if(!y(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 Pn(a,t)}))}:Pn(a,o));var a,o;return vr(r,s,i)},br=(t,e,i)=>{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 xr=0;function Sr(){return xr>1e8&&(xr=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+xr++}let Ar=class{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:Sr("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:Z.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}};const kr="_data-view-diff-rank";let Mr=class t{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:Sr("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[kr]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[kr]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[kr]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?I({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Gn),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}};class wr{static GenAutoIncrementId(){return wr.auto_increment_id++}}wr.auto_increment_id=0;class Tr{constructor(t){this.id=wr.GenAutoIncrementId(),this.registry=t}}const Cr="named",Er="inject",Pr="multi_inject",Br="inversify:tagged",Rr="inversify:paramtypes";class Lr{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Cr?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Or=function(t){var e;return function(t){const e=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,s=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",r="function"==typeof Object.create,a={__proto__:[]}instanceof Array,o=!r&&!a,l={create:r?function(){return k(Object.create(null))}:a?function(){return k({__proto__:null})}:function(){return k({})},has:o?function(t,i){return e.call(t,i)}:function(t,e){return e in t},get:o?function(t,i){return e.call(t,i)?t[i]:void 0}:function(t,e){return t[e]}},h=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){const t={},e=[],i=function(){function t(t,e,i){this._index=0,this._keys=t,this._values=e,this._selector=i}return t.prototype["@@iterator"]=function(){return this},t.prototype[n]=function(){return this},t.prototype.next=function(){const t=this._index;if(t>=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:i,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){const e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){const i=this._find(t,!0);return this._values[i]=e,this},e.prototype.delete=function(e){const i=this._find(e,!1);if(i>=0){const s=this._keys.length;for(let t=i+1;t{Ir(e,0,s,t)}}function Fr(t){return e=>(i,s,n)=>Dr(new Lr(t,e))(i,s,n)}const jr=Fr(Er),zr=Fr(Pr);function Hr(){return function(t){return Or.defineMetadata(Rr,null,t),t}}function Nr(t){return Dr(new Lr(Cr,t))}const Vr="Singleton",Gr="Transient",Wr="ConstantValue",Ur="DynamicValue",Yr="Factory",Kr="Function",Xr="Instance",$r="Invalid";class qr{constructor(t,e){this.id=wr.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=$r,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new qr(this.serviceIdentifier,this.scope);return t.activated=t.scope===Vr&&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 Zr{getConstructorMetadata(t){return{compilerGeneratedMetadata:Or.getMetadata(Rr,t),userGeneratedMetadata:Or.getMetadata(Br,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Jr=(Qr=Cr,t=>{const e=e=>{if(null==e)return!1;if(e.key===Qr&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const ia=Symbol("ContributionProvider");class sa{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function na(t,e){t(ia).toDynamicValue((t=>{let{container:i}=t;return new sa(e,i)})).inSingletonScope().whenTargetNamed(e)}class ra{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 aa extends ra{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const oa=Symbol.for("EnvContribution"),la=Symbol.for("VGlobal");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},ca=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 ua=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=wr.GenAutoIncrementId(),this.hooks={onSetEnv:new aa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};ua=ha([Hr(),da(0,jr(ia)),da(0,Nr(oa)),ca("design:paramtypes",[Object])],ua);var pa=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var ga=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||pa(t,"Boolean")};var fa=t=>"function"==typeof t;var ma=t=>null==t;var va=t=>null!=t;var ya=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var _a=t=>"object"==typeof t&&null!==t;var ba=function(t){if(!_a(t)||!pa(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 xa=t=>void 0===t;var Sa=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||pa(t,"String")};var Aa=t=>Array.isArray?Array.isArray(t):pa(t,"Array");var ka=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var Ma=t=>pa(t,"Date");var wa=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||pa(t,"Number")};var Ta=t=>wa(t)&&Number.isFinite(t);var Ca=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var Ea=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 Pa=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const Ba=Object.prototype;var Ra=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ba)};const La=Object.prototype.hasOwnProperty;function Oa(t){if(ma(t))return!0;if(ka(t))return!t.length;const e=Pa(t);if("Map"===e||"Set"===e)return!t.size;if(Ra(t))return!Object.keys(t).length;for(const e in t)if(La.call(t,e))return!1;return!0}var Ia=(t,e,i)=>{const s=Sa(e)?e.split("."):e;for(let e=0;enull!=t&&Da.call(t,e);function ja(t){let e;if(!va(t)||"object"!=typeof t)return t;const i=Aa(t),s=t.length;e=i?new Array(s):"object"==typeof t?{}:ga(t)||wa(t)||Sa(t)?t:Ma(t)?new Date(+t):void 0;const n=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(n||t).length;){const i=n?n[r]:r,s=t[i];e[i]=ja(s)}return e}function za(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(va(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];va(s[r])&&"object"==typeof s[r]?Ha(t,e,r,i):Na(t,r,s[r])}}}}function Ha(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(Aa(r)){if(s)a=[];else if(Aa(n))a=n;else if(ka(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(Sa(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function Wa(t){return Object.prototype.toString.call(t)}function Ua(t){return Object.keys(t)}function Ya(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(Wa(t)!==Wa(e))return!1;if(fa(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(Aa(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!Ya(t[s],e[s],i))return!1;return!0}if(!ba(t))return!1;const s=Ua(t),n=Ua(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(!Ya(t[r],e[r],i))return!1}return!0}function Ka(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0)&&(s=r)}return s},Ja=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function eo(t){if(!Aa(t))return[t];const e=[];for(const i of t)e.push(...eo(i));return e}function io(t,e,i){va(e)||(e=t,t=0),va(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function no(t){return Number(t)}const ro="undefined"!=typeof console;function ao(t,e,i){const s=[e].concat([].slice.call(i));ro&&console[t].apply(console,s)}var oo;!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"}(oo||(oo={}));class lo{static getInstance(t,e){return lo._instance&&wa(t)?lo._instance.level(t):lo._instance||(lo._instance=new lo(t,e)),lo._instance}static setInstance(t){return lo._instance=t}static setInstanceLevel(t){lo._instance?lo._instance.level(t):lo._instance=new lo(t)}static clearInstance(){lo._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:oo.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=oo.Info}canLogDebug(){return this._level>=oo.Debug}canLogError(){return this._level>=oo.Error}canLogWarn(){return this._level>=oo.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=oo.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):ao(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=oo.Warn&&ao(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=oo.Info&&ao(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=oo.Debug&&ao(this._method||"log","DEBUG",e),this}}lo._instance=null;const ho=1e-10,co=1e-10;function uo(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ho,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:co)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function po(t,e,i,s){return t>e&&!uo(t,e,i,s)}function go(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var mo=function(t,e,i){return ti?i:t};var vo=(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 yo(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let _o=!1;try{_o="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){_o=!1}function bo(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&_o;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function m(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function v(){const t=Date.now();if(m(t))return y(t);o=f(v,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?g(t):(s=n=void 0,a)}function _(){const t=Date.now(),i=m(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function Ao(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}_o=!1;const ko=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mo=new RegExp(ko.source,"g");function wo(t){if(Ta(t))return t;const e=+t;return Ta(e)?e:0}const To=1e-12,Co=Math.PI,Eo=Co/2,Po=2*Co,Bo=2*Math.PI,Ro=Math.abs,Lo=Math.atan2,Oo=Math.cos,Io=Math.max,Do=Math.min,Fo=Math.sin,jo=Math.sqrt,zo=Math.pow;function Ho(t){return t>1?0:t<-1?Co:Math.acos(t)}function No(t){return t>=1?Eo:t<=-1?-Eo:Math.asin(t)}function Vo(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 Go(t,e){return t[0]*e[1]-t[1]*e[0]}function Wo(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}class Uo{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Uo(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 wa(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return wa(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 Yo{static distancePP(t,e){return jo(zo(t.x-e.x,2)+zo(t.y-e.y,2))}static distanceNN(t,e,i,s){return jo(zo(t-i,2)+zo(e-s,2))}static distancePN(t,e,i){return jo(zo(e-t.x,2)+zo(i-t.y,2))}static pointAtPP(t,e,i){return new Uo((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Ko(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Xo{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Xo(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Aa(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ko(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 $o extends Xo{}function qo(t){return t*(Math.PI/180)}function Zo(t){return 180*t/Math.PI}const Jo=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Po;)t+=Po;else if(t>0)for(;t>Po;)t-=Po;return t};function Qo(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 tl(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function el(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}class il{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new il,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 il;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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new il(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=Zo(r.rotateDeg),r}}class sl{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 nl(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 rl(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 al=/^#([0-9a-f]{3,8})$/,ol={transparent:4294967040},ll={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 hl(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function cl(t){return wa(t)?new gl(t>>16,t>>8&255,255&t,1):Aa(t)?new gl(t[0],t[1],t[2]):new gl(255,255,255)}function dl(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ul(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class pl{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new pl(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new pl(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof pl?t:new pl(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(va(ol[t]))return function(t){return wa(t)?new gl(t>>>24,t>>>16&255,t>>>8&255,255&t):Aa(t)?new gl(t[0],t[1],t[2],t[3]):new gl(255,255,255,1)}(ol[t]);if(va(ll[t]))return cl(ll[t]);const e=`${t}`.trim().toLowerCase(),i=al.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new gl((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?cl(t):8===e?new gl(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new gl(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=nl(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new gl(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=pl.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new gl(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=rl(this.color.r,this.color.g,this.color.b),r=nl(ma(t)?n.h:mo(t,0,360),ma(e)?n.s:e>=0&&e<=1?100*e:e,ma(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new gl(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!ma(t)&&(this.color.r=t),!ma(e)&&(this.color.g=e),!ma(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=al.exec(e),s=parseInt(i[1],16),n=i[1].length;return 3===n?new gl((s>>8&15)+((s>>8&15)<<4),(s>>4&15)+((s>>4&15)<<4),(15&s)+((15&s)<<4),1):6===n?cl(s):8===n?new gl(s>>24&255,s>>16&255,s>>8&255,(255&s)/255):this}setColorName(t){const e=ll[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new pl(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=dl(t.color.r),this.color.g=dl(t.color.g),this.color.b=dl(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ul(t.color.r),this.color.g=ul(t.color.g),this.color.b=ul(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class gl{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)),va(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${hl(this.r)+hl(this.g)+hl(this.b)+(1===this.opacity?"":hl(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}=rl(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function fl(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 gl(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:rl});function vl(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let yl,_l,bl,xl,Sl,Al,kl,Ml;function wl(t,e,i,s){if(!function(t,e,i,s){let n,r=t[0],a=e[0],o=i[0],l=s[0];return a=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function Tl(t,e,i){return null===t?e:null===e?t:(yl=t.x1,_l=t.x2,bl=t.y1,xl=t.y2,Sl=e.x1,Al=e.x2,kl=e.y1,Ml=e.y2,i&&(yl>_l&&([yl,_l]=[_l,yl]),bl>xl&&([bl,xl]=[xl,bl]),Sl>Al&&([Sl,Al]=[Al,Sl]),kl>Ml&&([kl,Ml]=[Ml,kl])),yl>=Al||_l<=Sl||bl>=Ml||xl<=kl?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(yl,Sl),y1:Math.max(bl,kl),x2:Math.min(_l,Al),y2:Math.min(xl,Ml)})}var Cl;function El(t,e,i){return!(t&&e&&(i?(yl=t.x1,_l=t.x2,bl=t.y1,xl=t.y2,Sl=e.x1,Al=e.x2,kl=e.y1,Ml=e.y2,yl>_l&&([yl,_l]=[_l,yl]),bl>xl&&([bl,xl]=[xl,bl]),Sl>Al&&([Sl,Al]=[Al,Sl]),kl>Ml&&([kl,Ml]=[Ml,kl]),yl>Al||_lMl||xle.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)+(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(n.y-s)*Math.cos(e)+n.y}}function Rl(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ll(t,e){const i=e?t.angle:qo(t.angle),s=Rl(t);return[Bl({x:t.x1,y:t.y1},i,s),Bl({x:t.x2,y:t.y1},i,s),Bl({x:t.x2,y:t.y2},i,s),Bl({x:t.x1,y:t.y2},i,s)]}!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Cl||(Cl={}));const Ol=1e-8;function Il(t,e,i){let s=0,n=t[0];if(!n)return!1;for(let r=1;re&&r>s||rn?o:0}function Fl(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"};class zl{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(),va(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=va(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(ma(this._canvas)&&(va(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),ma(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&va(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),ma(this._context)&&va(this._canvas)){const t=this._canvas.getContext("2d");va(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:n=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(s?s+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!ma(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(Sa(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(ma(t))return{width:0,height:0};if(ma(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(ma(this._numberCharSize)){const t=this._standardMethod(zl.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/zl.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return ma(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(zl.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(ma(this._letterCharSize)){const t=this._standardMethod(zl.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/zl.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return va(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){va(this._canvas)&&(this._canvas=null),va(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}zl.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",zl.NUMBERS_CHAR_SET="0123456789",zl.FULL_SIZE_CHAR="字";const Hl=(t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}};function Nl(t){if(Ta(t))return[t,t,t,t];if(Aa(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(ya(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]}const Vl=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),Gl=Po-1e-8;class Wl{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Gl)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%=Po)<0&&(s+=Po),(n%=Po)<0&&(n+=Po),nn;++o,a-=Eo)g(a);else for(a=s-s%Eo+Eo,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Yl=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Kl={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},Xl={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let $l,ql,Zl,Jl,Ql,th;var eh,ih,sh,nh,rh,ah,oh,lh,hh;function ch(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),y=Math.sin(.5*v),_=8/3*y*y/Math.sin(v),b=e+p-_*g,x=i+g+_*p,S=e+f,A=i+m,k=S+_*m,M=A-_*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 dh(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=qo(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,y=d/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 k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(_+x)-k*(S-b),w=.5*(b+S)+k*(x-_),T=Math.atan2(b-w,_-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=Po:C>0&&0===r&&(C-=Po);const E=Math.ceil(Math.abs(C/(Eo+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function gh(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class kh extends Ah{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 Mh(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function wh(t,e,i){const s=null!=e?e:Ro(i[i.length-1].x-i[0].x)>Ro(i[i.length-1].y-i[0].y)?oh.ROW:oh.COLUMN;return"monotoneY"===t?new kh(t,s):new Ah(t,s)}class Th{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 Ch(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=wh("linear",i,t);return function(t,e){Mh(t,e)}(new Th(n,s),t),n}function Eh(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 Ph{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&&Eh(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:Eh(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 Bh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ch(t,e);const n=wh("basis",i,t);return function(t,e){Mh(t,e)}(new Ph(n,s),t),n}function Rh(t){return t<0?-1:1}function Lh(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(Rh(r)+Rh(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Oh(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ih(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 Dh{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:Ih(this,this._t0,Oh(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,Ih(this,Oh(this,e=Lh(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ih(this,this._t0,e=Lh(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 Fh extends Dh{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function jh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ch(t,e);const n=wh("monotoneX",i,t);return function(t,e){Mh(t,e)}(new Dh(n,s),t),n}function zh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Ch(t,e);const n=wh("monotoneY",i,t);return function(t,e){Mh(t,e)}(new Fh(n,s),t),n}let Hh=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Nh(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Ah("step",null!=s?s:Ro(t[t.length-1].x-t[0].x)>Ro(t[t.length-1].y-t[0].y)?oh.ROW:oh.COLUMN);return function(t,e){Mh(t,e)}(new Hh(r,e,n),t),r}class Vh extends Th{lineEnd(){this.context.closePath()}}function Gh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=wh("linear",i,t);return function(t,e){Mh(t,e)}(new Vh(n,s),t),n}function Wh(t,e,i){switch(e){case"linear":default:return Ch(t,i);case"basis":return Bh(t,i);case"monotoneX":return jh(t,i);case"monotoneY":return zh(t,i);case"step":return Nh(t,.5,i);case"stepBefore":return Nh(t,0,i);case"stepAfter":return Nh(t,1,i);case"linearClosed":return Gh(t,i)}}class Uh extends Ul{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Wl(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Xl.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Xl.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Xl.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([Xl.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([Xl.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([Xl.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([Xl.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([Xl.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Xl.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[Xl.M]=t=>`M${t[1]} ${t[2]}`,t[Xl.L]=t=>`L${t[1]} ${t[2]}`,t[Xl.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Xl.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Xl.A]=t=>{const e=[];uh(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Xl.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;tth){let t;for(let e=1,s=i.length;e{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),gh(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===oh.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ro(t.p0.y-e.p1.y)}if(this.direction===oh.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ro(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const Yh=["l",0,0,0,0,0,0,0];function Kh(t,e,i){const s=Yh[0]=t[0];if("a"===s||"A"===s)Yh[1]=e*t[1],Yh[2]=i*t[2],Yh[3]=t[3],Yh[4]=t[4],Yh[5]=t[5],Yh[6]=e*t[6],Yh[7]=i*t[7];else if("h"===s||"H"===s)Yh[1]=e*t[1];else if("v"===s||"V"===s)Yh[1]=i*t[1];else for(let s=1,n=t.length;s{lo.getInstance().warn("空函数")}}),hc=Object.assign(Object.assign({},ec),{points:[],cornerRadius:0,closePath:!0}),cc=Object.assign(Object.assign({},ec),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},ec),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const dc=Object.assign(Object.assign({},ec),{symbolType:"circle",size:10,keepDirIn3d:!0}),uc=Object.assign(Object.assign(Object.assign({},ec),Jh),{strokeBoundsBuffer:0,keepDirIn3d:!0}),pc=Object.assign(Object.assign(Object.assign({},ec),Jh),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),gc=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},ec),{fill:!0,cornerRadius:0}),fc=Object.assign(Object.assign({},gc),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const mc=new class{},vc={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"}},yc=!0,_c=!1,bc=/\w|\(|\)|-/,xc=/[.?!,;:/,。?!、;:]/,Sc=/\S/;function Ac(t,e,i,s,n){if(!e||e<=0)return 0;const r=mc.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=kc(t,a)),a}function kc(t,e){let i=e;for(;bc.test(t[i-1])&&bc.test(t[i])||xc.test(t[i]);)if(i--,i<=0)return e;return i}function Mc(t,e){const i=mc.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var wc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Tc=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=uc.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&r.str!==t){const i=kc(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length-1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length-1);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length-1)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=kc(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}};Tc=wc([Hr()],Tc);var Cc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ec=Symbol.for("TextMeasureContribution");let Pc=class extends Tc{};Pc=Cc([Hr()],Pc);const Bc=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Gr,this.options=e,this.id=wr.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Zr}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,Cr,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new qr(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ea(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[Er],multiInject:s[Pr]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Wr:case Kr:e=t.cache;break;case Xr: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===Vr&&(t.cache=e,t.activated=!0)}},Rc=Symbol.for("CanvasFactory"),Lc=Symbol.for("Context2dFactory");function Oc(t){return Bc.getNamed(Rc,mc.global.env)(t)}const Ic=1e-4,Dc=Math.sqrt(3),Fc=1/3;function jc(t){return t>-Jc&&tJc||t<-Jc}const Hc=[0,0],Nc=[0,0],Vc=[0,0];function Gc(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Wc(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Uc(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 Yc(t){return(t%=Bo)<0&&(t+=Bo),t}function Kc(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function Xc(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+=Bo);let d=Math.atan2(l,o);return d<0&&(d+=Bo),d>=s&&d<=n||d+Bo>=s&&d+Bo<=n}function Zc(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(jc(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 td=[-1,-1,-1],ed=[-1,-1];function id(){const t=ed[0];ed[0]=ed[1],ed[1]=t}function sd(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(jc(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,Fc):Math.pow(i,Fc),s=s<0?-Math.pow(-s,Fc):Math.pow(s,Fc);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+Dc*Math.sin(e)))/(3*a),h=(-o+i*(s-Dc*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,td);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&id(),p=Uc(e,s,r,o,ed[0]),u>1&&(g=Uc(e,s,r,o,ed[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(jc(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,td);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=Wc(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);td[0]=-l,td[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Bo-1e-4){s=0,n=Bo;const e=r?1:-1;return a>=td[0]+t&&a<=td[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Bo,n+=Bo);let c=0;for(let e=0;e<2;e++){const i=td[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Bo+t),(t>=s&&t<=n||t+Bo>=s&&t+Bo<=n)&&(t>Co/2&&t<1.5*Co&&(e=-e),c+=e)}}return c}function ad(t){return Math.round(t/Co*1e8)/1e8%2*Co}function od(t,e){let i=ad(t[0]);i<0&&(i+=Bo);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Bo?n=i+Bo:e&&i-n>=Bo?n=i-Bo:!e&&i>n?n=i+(Bo-ad(i-n)):e&&i1&&(i||(h+=Kc(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],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;ld[0]=S,ld[1]=A,od(ld,Boolean(a[6])),S=ld[0],A=ld[1];const k=S,M=A-S,w=!!(1-(a[6]?0:1)),T=(s-m)*y/y+m;switch(f){case Xl.M:u=m,p=v,c=u,d=p;break;case Xl.L:if(i){if(Zc(c,d,m,v,e,s,n))return!0}else h+=Kc(c,d,m,v,s,n)||0;c=m,d=v;break;case Xl.C:if(i){if($c(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=sd(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case Xl.Q:if(i){if(Xc(c,d,m,v,y,_,e,s,n))return!0}else h+=nd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case Xl.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Kc(c,d,o,l,s,n),i){if(qc(m,v,y,k,k+M,w,e,T,n))return!0}else h+=rd(m,v,y,k,k+M,w,T,n);c=Math.cos(k+M)*y+m,d=Math.sin(k+M)*y+v;break;case Xl.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Zc(u,p,o,p,e,s,n)||Zc(o,p,o,l,e,s,n)||Zc(o,l,u,l,e,s,n)||Zc(u,l,u,p,e,s,n))return!0}else h+=Kc(o,p,o,l,s,n),h+=Kc(u,l,u,p,s,n);break;case Xl.Z:if(i){if(Zc(c,d,u,p,e,s,n))return!0}else h+=Kc(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},ud=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const pd=Symbol.for("VWindow"),gd=Symbol.for("WindowHandlerContribution");let fd=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new aa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Bc.getNamed(gd,t.env).configure(this,t),this.actived=!0)},this._uid=wr.GenAutoIncrementId(),this.global=mc.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&this.width===t.width()&&this.height===t.height())}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};fd=dd([Hr(),ud("design:paramtypes",[])],fd);var md=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yd=function(t,e){return function(i,s){e(i,s,t)}};let _d=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=mc.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=cd.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Jh.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new zl(Object.assign({defaultFontParams:{fontFamily:Jh.fontFamily,fontSize:Jh.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+zl.ALPHABET_CHAR_SET+zl.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Bc.get(pd),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 bd;_d=md([Hr(),yd(0,jr(ia)),yd(0,Nr(Ec)),vd("design:paramtypes",[Object])],_d),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(bd||(bd={}));const xd=new il;let Sd=class{constructor(){this.matrix=new il}init(t){return this.mode=bd.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=bd.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(xd.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(xd.a,xd.b,xd.c,xd.d,xd.e,xd.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(xd.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(xd.a,xd.b,xd.c,xd.d,xd.e,xd.f),this}scale(t,e,i){return this.mode===bd.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===bd.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return xd.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(xd.a,xd.b,xd.c,xd.d,xd.e,xd.f),this}translate(t,e){return this.mode===bd.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===bd.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Sd=md([Hr(),vd("design:paramtypes",[])],Sd);const Ad={arc:ic,area:sc,circle:nc,line:oc,path:lc,symbol:dc,text:uc,rect:cc,polygon:hc,richtext:pc,richtextIcon:fc,image:gc,group:rc,glyph:ac},kd=Object.keys(Ad);function Md(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const wd={arc:Object.assign({},Ad.arc),area:Object.assign({},Ad.area),circle:Object.assign({},Ad.circle),line:Object.assign({},Ad.line),path:Object.assign({},Ad.path),symbol:Object.assign({},Ad.symbol),text:Object.assign({},Ad.text),rect:Object.assign({},Ad.rect),polygon:Object.assign({},Ad.polygon),richtext:Object.assign({},Ad.richtext),richtextIcon:Object.assign({},Ad.richtextIcon),image:Object.assign({},Ad.image),group:Object.assign({},Ad.group),glyph:Object.assign({},Ad.glyph)};class Td{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},kd.forEach((t=>{this._defaultTheme[t]=Object.create(wd[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,lo.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;kd.forEach((s=>{const n=Object.create(wd[s]);t&&t[s]&&Md(n,t[s]),i[s]&&Md(n,i[s]),e[s]&&Md(n,e[s]),this.combinedTheme[s]=n})),e.common&&kd.forEach((t=>{Md(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 Cd=new Td;function Ed(t,e){return t.glyphHost?Ed(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)):Cd.getTheme()}return null}(t)||t.attachedThemeGraphic&&Ed(t.attachedThemeGraphic)||Cd.getTheme()}var Pd=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 Bd 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=wr.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Pd(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&lo.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof Od))return void lo.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(jd(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 Od))return void lo.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=jd(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 Od))return void lo.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=jd(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 Od))return void lo.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=jd(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 Od))return void lo.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Fd.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(jd(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(jd(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,jd(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Od))return void lo.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"):jd(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 Id))return void lo.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=Fd.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new zd(s,{clickInterval:a}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Od,this.rootWheelEvent=new Id,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&&Sa(t)&&!Fa(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Gd{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return Gd.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class Wd{static Avaliable(){return!0}avaliable(){return Wd.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class Ud{static Avaliable(){return!!mc.global.getRequestAnimationFrame()}avaliable(){return Ud.Avaliable()}tick(t,e){mc.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var Yd;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Yd||(Yd={}));class Kd{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-Kd.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Kd.bounceIn(2*t):.5*Kd.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bo*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bo/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bo*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Bo/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Bo*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bo/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Bo/e)*.5+1}}}Kd.quadIn=Kd.getPowIn(2),Kd.quadOut=Kd.getPowOut(2),Kd.quadInOut=Kd.getPowInOut(2),Kd.cubicIn=Kd.getPowIn(3),Kd.cubicOut=Kd.getPowOut(3),Kd.cubicInOut=Kd.getPowInOut(3),Kd.quartIn=Kd.getPowIn(4),Kd.quartOut=Kd.getPowOut(4),Kd.quartInOut=Kd.getPowInOut(4),Kd.quintIn=Kd.getPowIn(5),Kd.quintOut=Kd.getPowOut(5),Kd.quintInOut=Kd.getPowInOut(5),Kd.backIn=Kd.getBackIn(1.7),Kd.backOut=Kd.getBackOut(1.7),Kd.backInOut=Kd.getBackInOut(1.7),Kd.elasticIn=Kd.getElasticIn(1,.3),Kd.elasticOut=Kd.getElasticOut(1,.3),Kd.elasticInOut=Kd.getElasticInOut(1,.3*1.5);class Xd{constructor(){this.id=wr.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===nh.END?this.removeAnimate(e):e.status===nh.RUNNING||e.status===nh.INITIAL?(this.animateCount++,e.advance(t)):e.status===nh.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const $d=new Xd;class qd{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class Zd extends qd{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let Jd=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wr.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$d;this.id=t,this.timeline=e,this.status=nh.INITIAL,this.tailAnimate=new Qd(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Io(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&rh.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:sh.ANIMATE_PLAY})}runCb(t){const e=new Zd((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,s,n,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,s,n,r,a)}pause(){this.status===nh.RUNNING&&(this.status=nh.PAUSED)}resume(){this.status===nh.PAUSED&&(this.status=nh.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new Qd(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===nh.RUNNING&&(this.status=nh.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=nh.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};Jd.mode=rh.NORMAL,Jd.interpolateMap=new Map;class Qd{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new tu(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?Kd[i]:i,n=this._addStep(e,null,s);return n.type=ah.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?Kd[i]:i,r=this._addStep(e,null,n);return r.type=ah.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=ah.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ah.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new tu(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return lo.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class tu{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const eu=200,iu="cubicOut",su=1e3,nu="quadInOut";var ru;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(ru||(ru={}));const au=[!1,!1,!1,!1],ou=[0,0,0,0],lu=t=>t?Aa(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ou[0]=t[0],ou[2]=t[0],ou[1]=t[1],ou[3]=t[1],ou):t:t:0,hu=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],cu=[1,2,3,0,1,2,3,0];function du(t,e,i,s){for(;t>=Bo;)t-=Bo;for(;t<0;)t+=Bo;for(;t>e;)e+=Bo;hu[0].x=i,hu[1].y=i,hu[2].x=-i,hu[3].y=-i;const n=Math.ceil(t/Eo)%4,r=Math.ceil(e/Eo)%4;if(s.add(Oo(t)*i,Fo(t)*i),s.add(Oo(e)*i,Fo(e)*i),n!==r||e-t>Co){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Uo(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Uo(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:mu.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}mu.TimeOut=1e3/60;const vu=new mu,yu=(t,e)=>Sa(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class _u extends qd{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=wa(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=wa(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Wo(this.fromNumber),Wo(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var bu;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(bu||(bu={}));class xu extends qd{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,s=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=s?Array.isArray(s)?s:[s]:[];const n=new Map;this.fromPoints.forEach((t=>{t.context&&n.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(n.has(this.toPoints[t].context)){l=t,a=n.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=n.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Uo(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=uu(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Su extends qd{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:sh.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:sh.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:sh.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Au extends Su{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:{},y=null!==(o=v.width)&&void 0!==o?o:0,_=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=mc.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:y/2,y:null!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/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 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 ku extends Su{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",y=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",_=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=mc.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===y?0:f,height:"in"===v&&"y"===y?0:m,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===_?(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 Mu extends qd{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class wu extends qd{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((s=>{const n=s.easing,r="string"==typeof n?Kd[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Tu(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 Cu(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i{uo(e,s)&&uo(i,n)||t.push(e,i,s,n,s,n)};function Ou(t){const e=t.commandList,i=[];let s,n=0,r=0,a=0,o=0;const l=(t,e)=>{s&&s.length>2&&i.push(s),s=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(s),i}function Iu(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t{if(!t)return{x:0,y:0,width:0,height:0};let e=ma(t.width)?t.x1-t.x:t.width,i=ma(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}};function ju(t,e,i){const s=t/e;let n,r;t>=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&wa(t.x)&&wa(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}))),Nu=(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]},Vu=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Xo;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 Nu(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return Nu(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);Vu(n[0],s,i),Vu(n[1],e-s,i)}};var Gu;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Gu||(Gu={}));class Wu{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gu.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Gu.Color1){const e=Wu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=pl.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Wu.store1[t]=e,Wu.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=Wu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=pl.parseColorString(t);return n&&(Wu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Wu.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===Gu.Color1){if(Wu.store1[t])return;Wu.store1[t]=i,Wu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Wu.store255[t])return;Wu.store255[t]=i,Wu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Uu(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&wa(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 Yu(t,e,i,s,n){return Array.isArray(t)&&!wa(t[0])||Array.isArray(e)&&!wa(e[0])?new Array(4).fill(0).map(((n,r)=>Ku(Aa(t)?t[r]:t,Aa(e)?e[r]:e,i,s))):Ku(t,e,i,s,n)}function Ku(t,e,i,s,n){if(!t||!e)return t&&Uu(t)||e&&Uu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Wu.Get(t,Gu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Wu.Get(e,Gu.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:Uu(a)})))});return o?Yu(r,l,i,s,n):Yu(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:qu(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:qu(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:qu(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),Uu(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)}Wu.store255={},Wu.store1={};const Xu=[0,0,0,0],$u=[0,0,0,0];function qu(t,e,i){return Wu.Get(t,Gu.Color255,Xu),Wu.Get(e,Gu.Color255,$u),`rgba(${Math.round(Xu[0]+($u[0]-Xu[0])*i)},${Math.round(Xu[1]+($u[1]-Xu[1])*i)},${Math.round(Xu[2]+($u[2]-Xu[2])*i)},${Xu[3]+($u[3]-Xu[3])*i})`}const Zu=(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=Yu(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Ju=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Ou(t):[],n=Ou(e);i&&s&&(i.fromTransform&&Iu(s,i.fromTransform.clone().getInverse()),Iu(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})))},tp=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ep=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!tp.includes(n))return;const r=e[n];ma(r)||ma(t[n])||r===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?Wu.Get(t[n],Gu.Color255):t[n],to:"string"==typeof r?Wu.Get(r,Gu.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class ip extends qd{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Ju(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Zu(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const sp=(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=Qu(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=ep(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new ip({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:su,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:nu)),c};class np extends qd{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Ju(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&&Zu(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const rp=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>gu.includes(t))(i)||(e[i]=t[i])})),e},ap=(t,e,i)=>{const s=rp(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=mc.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},op=(t,e,i)=>{const s=[],n=i?null:rp(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:rp(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Fu(t.attribute),n=ju(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(mc.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=ju(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(mc.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=ju(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(mc.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 zu(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 zu(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(mc.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:Hu(i)}];const s=[];return Vu(i,e,s),s})(t,e).forEach((t=>{s.push(mc.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&&wa(t.x)&&wa(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 Vu(r,e,h),h})(t,e).forEach((t=>{s.push(mc.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Ou(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(mc.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(mc.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&ap(t,s,e),s};class hp{static GetImage(t,e){var i;const s=hp.cache.get(t);s?"fail"===s.loadState?mc.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):hp.loadImage(t,e)}static GetSvg(t,e){var i;let s=hp.cache.get(t);s?"fail"===s.loadState?mc.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"},hp.cache.set(t,s),s.dataPromise=mc.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))}))}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=hp.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},hp.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=mc.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=mc.global.loadBlob(t):"json"===e&&(i.dataPromise=mc.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!hp.isLoading&&hp.toLoadAueue.length){hp.isLoading=!0;const t=hp.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(hp.cache.set(i,n),n.dataPromise=mc.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))}))}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{hp.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),hp.loading()})).catch((t=>{console.error(t),hp.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),hp.loading()}))}}),0)}static loadImage(t,e){const i=cp(t,hp.toLoadAueue);if(-1!==i)return hp.toLoadAueue[i].marks.push(e),void hp.loading();hp.toLoadAueue.push({url:t,marks:[e]}),hp.loading()}static improveImageLoading(t){const e=cp(t,hp.toLoadAueue);if(-1!==e){const t=hp.toLoadAueue.splice(e,1);hp.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function cp(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new $o,this._updateTag=eh.INIT,this.attribute=t,this.valid=this.isValid(),t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;vp.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),vp.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else vp.x=n,vp.y=r;return vp}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;mc.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return mc.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new il),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&eh.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&eh.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&eh.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&eh.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&eh.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&eh.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=eh.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===ih.GLOBAL){const i=new Uo(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:pp;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:pp;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(mc.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!ma(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate();d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:eu,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:iu),c&&this.setAttributes(c,!1,{type:sh.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:sh.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();Fa(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=eh.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=eh.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=eh.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&eh.UPDATE_SHAPE_AND_BOUNDS)===eh.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=eh.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=eh.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=eh.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=eh.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=eh.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=eh.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=eh.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&eh.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return up.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(up),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=Xh.x,y:e=Xh.y,scaleX:i=Xh.scaleX,scaleY:s=Xh.scaleY,angle:n=Xh.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Oo(a),f=Fo(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+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*y-S*_,t.f=p+h*m+d*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),mc.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Xh);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=dp.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),mc.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:sh.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:sh.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=Yu(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=Yu(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=Yu(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return Ed(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:mc.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return Sa(t,!0)?this.pathProxy=(new Uh).fromString(t):this.pathProxy=new Uh,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",mc.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Dd(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)}}}_p.mixin(Hd);class bp{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 xp(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Sp(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Ap=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class kp{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Sp(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=xp(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Sp(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 bp(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 bp(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 Mp(t,e){return wp(t)}function wp(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Rp=0;function Lp(){return Rp++}var Op;function Ip(t){const e=[];let i=0,s="";for(let n=0;nDp.set(t,!0)));const Fp=new Map;function jp(t){if(Dp.has(t))return!0;if(Fp.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Fp.set(t,!0)));const zp=Lp(),Hp=Lp(),Np=Lp(),Vp=Lp(),Gp=Lp(),Wp=Lp(),Up=Lp(),Yp=Lp(),Kp=Lp(),Xp=Lp();Lp();const $p=Lp();Lp();const qp=Lp(),Zp=Lp(),Jp=Lp(),Qp=Symbol.for("GraphicService"),tg=Symbol.for("GraphicCreator"),eg={"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"},ig=Object.keys(eg);var sg;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(sg||(sg={}));let ng=class t extends _p{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Wp,this._childUpdateTag=eh.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 Td),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Td)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===ih.GLOBAL){const i=new Uo(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&eh.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;mc.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),mc.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=Xh.x,y:e=Xh.y,dx:i=Xh.dx,dy:s=Xh.dy,scaleX:n=Xh.scaleX,scaleY:r=Xh.scaleY,angle:a=Xh.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=Ed(this).group;this._AABBBounds.clear();const i=mc.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=lu(s);return n&&i.expand(n),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=eh.CLEAR_BOUNDS,this._childUpdateTag&=eh.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=eh.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&eh.UPDATE_BOUNDS||(this._childUpdateTag|=eh.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(),mc.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),mc.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,mc.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{mc.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),mc.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&eh.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=mc.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function rg(t){return new ng(t)}ng.NOWORK_ANIMATE_ATTR=yp;class ag extends ng{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 Td,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{mc.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=>{mc.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 og=Symbol.for("TransformUtil"),lg=Symbol.for("GraphicUtil"),hg=Symbol.for("LayerService"),cg=Symbol.for("StaticLayerHandlerContribution"),dg=Symbol.for("DynamicLayerHandlerContribution"),ug=Symbol.for("VirtualLayerHandlerContribution");var pg,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)};let mg=pg=class{static GenerateLayerId(){return`${pg.idprefix}_${pg.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=mc.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?Bc.get(cg):"dynamic"===t?Bc.get(dg):Bc.get(ug),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new ag(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:pg.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)}};mg.idprefix="visactor_layer",mg.prefix_count=0,mg=pg=gg([Hr(),fg("design:paramtypes",[])],mg);var vg=new Tr((t=>{t(la).to(ua).inSingletonScope(),t(pd).to(fd),t(lg).to(_d).inSingletonScope(),t(og).to(Sd).inSingletonScope(),t(hg).to(mg).inSingletonScope()}));function yg(t,e){return!(!t&&!e)}function _g(t,e){let i;return i=Aa(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function bg(t,e,i){return i&&t*e>0}function xg(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Sg(t,e){return t*e>0}function Ag(t,e,i,s){return t*e>0&&0!==i&&0!==s}function kg(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,d=o-r;let u=d*l-c*h;return u*uP*P+B*B&&(k=w,M=T),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function wg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ro(l-o),c=l>o;let d=!1;if(n=Bo-To)e.moveTo(i+n*Oo(o),s+n*Fo(o)),e.arc(i,s,n,o,l,!c),r>To&&(e.moveTo(i+r*Oo(l),s+r*Fo(l)),e.arc(i,s,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:v,innerStartAngle:y}=t.getParsePadAngle(o,l),_=u,b=u,x=u,S=u,A=Math.max(b,_),k=Math.max(x,S);let M=A,w=k;const T=n*Oo(f),C=n*Fo(f),E=r*Oo(v),P=r*Fo(v);let B,R,L,O;if((k>To||A>To)&&(B=n*Oo(m),R=n*Fo(m),L=r*Oo(y),O=r*Fo(y),hTo){const t=Do(_,M),r=Do(b,M),o=Mg(L,O,T,C,n,t,Number(c)),l=Mg(B,R,E,P,n,r,Number(c));M0&&e.arc(i+o.cx,s+o.cy,t,Lo(o.y01,o.x01),Lo(o.y11,o.x11),!c),e.arc(i,s,n,Lo(o.cy+o.y11,o.cx+o.x11),Lo(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Lo(l.y11,l.x11),Lo(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Oo(Lo(l.y01,l.x01)),s+l.cy+r*Fo(Lo(l.y01,l.x01))):e.moveTo(i+B,s+n*Fo(m))}else!a||a[0]?(e.moveTo(i+T,s+C),e.arc(i,s,n,f,m,!c)):e.moveTo(i+n*Oo(m),s+n*Fo(m));if(!(r>To)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(w>To){const t=Do(S,w),n=Do(x,w),o=Mg(E,P,B,R,r,-n,Number(c)),l=Mg(T,C,L,O,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,Lo(o.y01,o.x01),Lo(o.y11,o.x11),!c),e.arc(i,s,r,Lo(o.cy+o.y11,o.cx+o.x11),Lo(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Lo(l.y11,l.x11),Lo(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Oo(Lo(l.y01,l.x01)),s+l.cy+t*Fo(Lo(l.y01,l.x01))):e.moveTo(i+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,y,c):e.moveTo(i+r*Oo(y),s+r*Fo(y))}return a?a[3]&&e.lineTo(i+n*Oo(o),s+n*Fo(o)):e.closePath(),d}class Tg{static GetCanvas(){try{return Tg.canvas||(Tg.canvas=mc.global.createCanvas({})),Tg.canvas}catch(t){return null}}static GetCtx(){if(!Tg.ctx){const t=Tg.GetCanvas();Tg.ctx=t.getContext("2d")}return Tg.ctx}}class Cg extends sl{static getInstance(){return Cg._instance||(Cg._instance=new Cg),Cg._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Tg.GetCanvas(),s=Tg.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Cg(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Eg{static GetSize(t){for(let e=0;e=t)return Eg.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Eg.GenKey(t,e,i,s,n),l=Eg.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=Eg.GenKey(t,e,i,s,n);Eg.cache[l]?Eg.cache[l].push({width:a,height:o,pattern:r}):Eg.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Eg.cache={},Eg.ImageSize=[20,40,80,160,320,640,1280,2560];const Pg=Symbol.for("ArcRenderContribution"),Bg=Symbol.for("AreaRenderContribution"),Rg=Symbol.for("CircleRenderContribution"),Lg=Symbol.for("GroupRenderContribution"),Og=Symbol.for("ImageRenderContribution"),Ig=Symbol.for("PathRenderContribution"),Dg=Symbol.for("PolygonRenderContribution"),Fg=Symbol.for("RectRenderContribution"),jg=Symbol.for("SymbolRenderContribution"),zg=Symbol.for("TextRenderContribution"),Hg=Symbol.for("InteractiveSubRenderContribution"),Ng=["radius","startAngle","endAngle",...pp];class Vg extends _p{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Vp}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=Ed(this).circle;this._AABBBounds.clear();const i=this.attribute,s=mc.graphicService.updateCircleAABBBounds(i,Ed(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=lu(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ed(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new Uh;return o.arc(0,0,n,r,a),o}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Vg(t)}function Wg(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function Ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Yg(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}Vg.NOWORK_ANIMATE_ATTR=yp;class Kg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;at.text)).join("")!==e.text.toString():null!=this.clipedText&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Jp,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return Aa(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}doUpdateAABBBounds(){const t=Ed(this).text;this._AABBBounds.clear();const e=this.attribute,i=mc.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=lu(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Ed(this).text,{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:y=0,lineClamp:_}=this.attribute,b=null!==(e=yu(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,x=m?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const S=mc.graphicUtil.textMeasure,A=new Kg(a,{fontSize:h,fontWeight:f,fontFamily:a},S),k=Aa(t)?t.map((t=>t.toString())):[t.toString()],M=[],w=[0,0];let T=1/0;if(y>0&&(T=Math.max(Math.floor(y/b),1)),_&&(T=Math.min(T,_)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),w[0]=t}else{let t,e,i=0;for(let s=0,n=k.length;s{const e=t.direction===Op.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:f});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=Ug(x,o),M=Yg(S,b,p);return this._AABBBounds.set(M,k,M+b,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=Ed(this).text,{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:f=s.whiteSpace,suffixPosition:m=s.suffixPosition}=r,v=null!==(e=yu(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===f)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const y=mc.graphicUtil.textMeasure,_=new Kg(a,{fontSize:h,fontWeight:c,fontFamily:a},y).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,m),{bbox:b}=_;return this.cache.layoutData=_,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=Ed(this).text,a=mc.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:f=r.fontWeight,stroke:m=r.stroke,lineWidth:v=r.lineWidth,verticalMode:y=r.verticalMode,suffixPosition:_=r.suffixPosition}=l,b=null!==(i=yu(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!y){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Io(e,o)}));const t=Ug(x,o),e=this.cache.verticalList.length*b,i=Yg(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>Ip(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,i,!1,_);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Op.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:f,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Io(e,o)}));const k=Ug(x,o),M=this.cache.verticalList.length*b,w=Yg(S,M,g);return this._AABBBounds.set(w,k,w+M,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ed(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xg;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xg;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function qg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},yp),$g.baselineMapAlign={top:"left",bottom:"right",middle:"center"},$g.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class Zg{bounds(t,e){if(wa(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function Jg(t,e,i,s,n){return n?t.arc(i,s,e,0,Po,!1,n):t.arc(i,s,e,0,Po),!1}var Qg=new class extends Zg{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 Jg(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Jg(t,e/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var tf=new class extends Zg{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,e/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,e/6,i,s,n,r)}};function ef(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 sf=new class extends Zg{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 ef(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return ef(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ef(t,e/2+n,i,s,r)}};function nf(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var rf=new class extends Zg{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return nf(t,e/2,i,s)}drawOffset(t,e,i,s,n){return nf(t,e/2+n,i,s)}};class af extends Zg{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i+e,e+s),t.lineTo(i-e,e+s),t.lineTo(i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}}var of=new af;var lf=new class extends af{constructor(){super(...arguments),this.type="triangle"}};const hf=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),cf=Math.sin(Po/10)*hf,df=-Math.cos(Po/10)*hf;function uf(t,e,i,s){const n=cf*e,r=df*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Po*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 pf=new class extends Zg{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 uf(t,e/2,i,s)}drawOffset(t,e,i,s,n){return uf(t,e/2+n,i,s)}};const gf=jo(3);function ff(t,e,i,s){const n=e,r=n/gf,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 mf=new class extends Zg{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 ff(t,e/2,i,s)}drawOffset(t,e,i,s,n){return ff(t,e/2+n,i,s)}};function vf(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 yf=new class extends Zg{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return vf(t,e/2,i,s)}drawOffset(t,e,i,s,n){return vf(t,e/2+n,i,s)}};function _f(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var bf=new class extends Zg{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return _f(t,e/2,i,s)}drawOffset(t,e,i,s,n){return _f(t,e/2+n,i,s)}};const xf=-.5,Sf=jo(3)/2,Af=1/jo(12);function kf(t,e,i,s){const n=e/2,r=e*Af,a=n,o=e*Af+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(xf*n-Sf*r+i,Sf*n+xf*r+s),t.lineTo(xf*a-Sf*o+i,Sf*a+xf*o+s),t.lineTo(xf*l-Sf*h+i,Sf*l+xf*h+s),t.lineTo(xf*n+Sf*r+i,xf*r-Sf*n+s),t.lineTo(xf*a+Sf*o+i,xf*o-Sf*a+s),t.lineTo(xf*l+Sf*h+i,xf*h-Sf*l+s),t.closePath(),!1}var Mf=new class extends Zg{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 kf(t,e/2,i,s)}drawOffset(t,e,i,s,n){return kf(t,e/2+n,i,s)}};var wf=new class extends Zg{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(e+i,e+s),t.lineTo(e+i,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var Tf=new class extends Zg{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,e+s),t.lineTo(e+i,s),t.lineTo(i-e,s-e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}(t,e/2,i,s,n)}};var Cf=new class extends Zg{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return function(t,e,i,s){return t.moveTo(i-e,s-e),t.lineTo(i+e,s-e),t.lineTo(i,s+e),t.closePath(),!0}(t,e/2,i,s)}drawOffset(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}(t,e/2,i,s,n)}};const Ef=jo(3);function Pf(t,e,i,s){const n=e*Ef;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Bf=new class extends af{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Pf(t,e/2/Ef,i,s)}drawOffset(t,e,i,s,n){return Pf(t,e/2/Ef+n,i,s)}};function Rf(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 Lf=new class extends Zg{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 Rf(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Rf(t,e/4+n,i,s)}};function Of(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 If=new class extends Zg{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 Of(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Of(t,e/4+n,i,s)}};function Df(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 Ff=new class extends Zg{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 Df(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Df(t,e/4+n,i,s)}};function jf(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 zf=new class extends Zg{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 jf(t,e/4,i,s)}drawOffset(t,e,i,s,n){return jf(t,e/4+n,i,s)}};function Hf(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Nf=new class extends Zg{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Hf(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return Hf(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Vf(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Gf=new class extends Zg{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Vf(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return Vf(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Wf(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 Uf=new class extends Zg{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 Wf(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return Wf(t,e/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=t/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Yf(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Kf(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Xf=new class extends Zg{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 wa(e)?Kf(t,e,i,s):Yf(t,e,i,s)}drawOffset(t,e,i,s,n){return wa(e)?Kf(t,e+2*n,i,s):Yf(t,[e[0]+2*n,e[1]+2*n],i,s)}};const $f=new $o;class qf{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,Aa(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),gh(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(gh(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),gh(n.path.commandList,t,i,s,e,e),r&&r(n.path,n.attribute)})),!1):(gh(this.path.commandList,t,i,s,e,e),!1)}bounds(t,e){if(this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;$f.x1=s.bounds.x1*t,$f.y1=s.bounds.y1*t,$f.x2=s.bounds.x2*t,$f.y2=s.bounds.y2*t,e.union($f)}))}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 Zf={};[Qg,tf,sf,rf,Bf,lf,pf,mf,yf,bf,Mf,wf,Tf,of,Cf,Lf,If,Ff,zf,Xf,Nf,Gf,Uf].forEach((t=>{Zf[t.type]=t}));const Jf={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"},Qf=new $o,tm=["symbolType","size",...pp];let em=class t extends _p{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Zp}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return Aa(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=Ed(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=Zf[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=Jf[i]||i,!0===((n=i).startsWith("{const e=(new Uh).fromString(t.d),i={};ig.forEach((e=>{t[e]&&(i[eg[e]]=t[e])})),r.push({path:e,attribute:i}),Qf.union(e.bounds)}));const a=Qf.width(),o=Qf.height(),l=1/Io(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new qf(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new Uh).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Io(a,o);return r.transform(0,0,l,l),this._parsedPath=new qf(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Ed(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=mc.graphicService.updateSymbolAABBBounds(i,Ed(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=lu(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ed(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,tm)}needUpdateTag(t){return super.needUpdateTag(t,tm)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=Aa(e)?e:[e,e];return t.path?(new Uh).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Uh).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function im(t){return new em(t)}em.userSymbolMap={},em.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},yp);const sm=["segments","points","curveType",...pp];let nm=class t extends _p{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Yp}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=pu(i,s,e))}doUpdateAABBBounds(){const t=Ed(this).line;this._AABBBounds.clear();const e=this.attribute,i=mc.graphicService.updateLineAABBBounds(e,Ed(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=lu(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ed(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,sm)}needUpdateTag(t){return super.needUpdateTag(t,sm)}toCustomPath(){const t=this.attribute,e=new Uh,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function rm(t){return new nm(t)}nm.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},yp);const am=["width","x1","y1","height","cornerRadius",...pp];class om extends _p{constructor(t){super(t),this.type="rect",this.numberType=$p}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Ed(this).rect;this._AABBBounds.clear();const e=this.attribute,i=mc.graphicService.updateRectAABBBounds(e,Ed(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=lu(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ed(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,am)}needUpdateTag(t){return super.needUpdateTag(t,am)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=Fu(t),r=new Uh;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new om(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return om.NOWORK_ANIMATE_ATTR}}function lm(t){return new om(t)}om.NOWORK_ANIMATE_ATTR=yp;class hm extends _p{constructor(t){super(t),this.type="glyph",this.numberType=Gp,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.clear();const t=mc.graphicService.updateGlyphAABBBounds(this.attribute,Ed(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new hm(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return hm.NOWORK_ANIMATE_ATTR}}function cm(t){return new hm(t)}hm.NOWORK_ANIMATE_ATTR=yp;class dm{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=vc[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class um{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=yu(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Mc(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Mc(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ac(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Mc(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||_c;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||yc;if(!i)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.fillStyle=i;let r=e.fontSize||16;switch(e.script){case"super":case"sub":r*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:r,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Ac(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Mc(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const pm=["width","height","image",...pp];class gm extends _p{constructor(t){super(t),this.type="image",this.numberType=Up,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}doUpdateAABBBounds(){const t=Ed(this).image;this._AABBBounds.clear();const e=this.attribute,i=mc.graphicService.updateImageAABBBounds(e,Ed(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=lu(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return gc[t]}needUpdateTags(t){return super.needUpdateTags(t,pm)}needUpdateTag(t){return super.needUpdateTag(t,pm)}clone(){return new gm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return gm.NOWORK_ANIMATE_ATTR}}function fm(t){return new gm(t)}gm.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},yp);class mm extends gm{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=lu(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(Aa(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=lu(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=gc.width,height:e=gc.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 vm{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 mm?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=vc[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof um){const e=Sc.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s.overflow)continue;if(s instanceof mm)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Mc(r,s.character),o=a||0;if(o<=this.blankWidth+t){e&&(s.ellipsis="add");break}if(o<=this.blankWidth+t+s.width){s.ellipsis="replace",s.ellipsisWidth=o,s.ellipsisOtherParagraphWidth=this.blankWidth+t;break}s.ellipsis="hide",t+=s.width}}this.paragraphs.map(((e,n)=>{if(e instanceof mm)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof mm)break;const{width:n}=Mc(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.map(((t,e)=>{i+=t instanceof mm?t.width:t.getWidthWithEllips(this.direction)})),i}}class ym{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=vc[this.direction]}store(t){if(t instanceof mm){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 vm(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof mm?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,s=Ac(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==s){const[e,i]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new um(i,t.newLine,t.character),new um(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const _m=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...pp];class bm extends _p{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=qp}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:pc.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:pc.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:pc.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:pc.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:pc.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:pc.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:pc.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:pc.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Ed(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=mc.graphicService.updateRichTextAABBBounds(e,Ed(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=lu(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return pc[t]}needUpdateTags(t){return super.needUpdateTags(t,_m)}needUpdateTag(t){return super.needUpdateTag(t,_m)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:s,fontFamily:n,fontStyle:r,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:s,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:d,layoutDirection:u,singleLine:p,disableAutoWrapLine:g}=this.attribute,f=[],m=null!=t?t:i;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,f.push(t)}}else{const e=this.combinedStyleToCharacter(m[t]);if(wa(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,y="number"==typeof n&&Number.isFinite(n)&&n>0,_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!y||a<=n),x=new dm(0,0,(_?r:v?s:0)||0,(b?a:y?n:0)||0,o,l,h,c,d,u||"horizontal",!_&&v,!b&&y,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),S=new ym(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,s,n,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(r=n.attribute.x)&&void 0!==r?r:0)+i,n.globalY=(null!==(a=n.attribute.y)&&void 0!==a?a:0)+s)})),n}getNoWorkAnimateAttr(){return bm.NOWORK_ANIMATE_ATTR}}function xm(t){return new bm(t)}bm.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},yp);const Sm=["path","customPath",...pp];class Am extends _p{constructor(t){super(t),this.type="path",this.numberType=Kp}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=Ed(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Uh?e.path:(ma(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Uh?this.cache:t.path)}doUpdateAABBBounds(){const t=Ed(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=mc.graphicService.updatePathAABBBounds(e,Ed(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=lu(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;Sa(t.path,!0)?this.cache=(new Uh).fromString(t.path):t.customPath&&(this.cache=new Uh,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ed(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Sm)}needUpdateTag(t){return super.needUpdateTag(t,Sm)}toCustomPath(){return(new Uh).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Am(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Am.NOWORK_ANIMATE_ATTR}}function km(t){return new Am(t)}Am.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},yp);const Mm=["segments","points","curveType",...pp];class wm extends _p{constructor(t){super(t),this.type="area",this.numberType=Np}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}doUpdateAABBBounds(){const t=Ed(this).area;this._AABBBounds.clear();const e=this.attribute,i=mc.graphicService.updateAreaAABBBounds(e,Ed(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=lu(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=pu(i,s,e))}getDefaultAttribute(t){return Ed(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Mm)}needUpdateTag(t){return super.needUpdateTag(t,Mm)}toCustomPath(){const t=new Uh,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 wm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return wm.NOWORK_ANIMATE_ATTR}}function Tm(t){return new wm(t)}wm.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},yp);const Cm=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...pp];class Em extends _p{constructor(t){super(t),this.type="arc",this.numberType=zp}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=Ed(this).arc,{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r);return Math.min(wa(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Ed(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=Jo(e),i=e+r,s&&Ro(r)To&&o>To)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=Ed(this).arc,{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=jo(a*a+o*o)}=this.attribute,h=Ro(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>To&&l>To){const i=e>t?1:-1;let s=No(Number(l)/o*Fo(g)),n=No(Number(l)/a*Fo(g));return(f-=2*s)>To?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>To?(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}}doUpdateAABBBounds(t){const e=Ed(this).arc;this._AABBBounds.clear();const i=this.attribute,s=mc.graphicService.updateArcAABBBounds(i,Ed(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=lu(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Cm)}needUpdateTag(t){return super.needUpdateTag(t,Cm)}getDefaultAttribute(t){return Ed(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let s=t.innerRadius-(t.innerPadding||0),n=t.outerRadius-(t.outerPadding||0);const r=Ro(i-e),a=i>e;if(n=Bo-To)o.moveTo(0+n*Oo(e),0+n*Fo(e)),o.arc(0,0,n,e,i,!a),s>To&&(o.moveTo(0+s*Oo(i),0+s*Fo(i)),o.arc(0,0,s,i,e,a));else{const t=n*Oo(e),r=n*Fo(e),l=s*Oo(i),h=s*Fo(i);o.moveTo(0+t,0+r),o.arc(0,0,n,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,s,i,e,a),o.closePath()}return o}clone(){return new Em(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Em.NOWORK_ANIMATE_ATTR}}function Pm(t){return new Em(t)}Em.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},yp);const Bm=["points","cornerRadius",...pp];class Rm extends _p{constructor(t){super(t),this.type="polygon",this.numberType=Xp}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Ed(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=mc.graphicService.updatePolygonAABBBounds(e,Ed(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=lu(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=pu(i,s,e))}getDefaultAttribute(t){return Ed(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Bm)}needUpdateTag(t){return super.needUpdateTag(t,Bm)}toCustomPath(){const t=this.attribute.points,e=new Uh;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new Rm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rm.NOWORK_ANIMATE_ATTR}}function Lm(t){return new Rm(t)}Rm.NOWORK_ANIMATE_ATTR=yp;class Om extends ng{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Im(t){return new Om(t)}class Dm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i}}class Fm extends Dm{updateBounds(t,e,i,s){const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=n;Bp(i,s+(r+o)/2,!0,a)}return i}}class jm{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return jm.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},Vm=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)}};function Wm(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 Um(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Ym(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],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Km(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,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(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),Wm(t,t,[n+o,r+l,a+h]),Wm(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],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),Wm(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,d,u]),f){const i=Hm.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]}Wm(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),Wm(i,i,[-s[0],-s[1],0]),Ym(t,t,i)}}let Xm=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new aa(["graphic"]),onSetStage:new aa(["graphic","stage"]),onRemove:new aa(["graphic"]),onRelease:new aa(["graphic"]),onAddIncremental:new aa(["graphic","group","stage"]),onClearIncremental:new aa(["graphic","group","stage"]),beforeUpdateAABBBounds:new aa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new aa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new $o,this.tempAABBBounds2=new $o,this._rectBoundsContribitions=[new Dm],this._symbolBoundsContribitions=[new Fm],this._imageBoundsContribitions=[new Dm],this._circleBoundsContribitions=[new Dm],this._arcBoundsContribitions=[new Dm],this._pathBoundsContribitions=[new Dm]}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Wl(t);return gh(i.commandList,s,0,0),!0}updateRectAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateGroupAABBBounds(t,e,i,s){const n=i;i=i.clone();const{width:r,height:a,path:o,clip:l=e.clip,display:h}=t;o&&o.length?o.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=a&&i.set(0,0,Math.max(0,r),Math.max(0,a)),l||s.forEachChildren((t=>{i.union(t.AABBBounds)}));const c=this.tempAABBBounds1,d=this.tempAABBBounds2;return c.setValue(i.x1,i.y1,i.x2,i.y2),d.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),n.copy(i),n}updateGlyphAABBBounds(t,e,i,s){return this._validCheck(t,e,i,s)?(s.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i):i}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=wa(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Yg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=wa(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Ug(n,e);i.set(s,i.y1,s+e,i.y2)}}updateRichTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{width:n=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=s.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=n||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),this.transformAABBBounds(t,i,e,!1,s),i}updateTextAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!s)return i;const{text:n=e.text}=s.attribute;Array.isArray(n)?s.updateMultilineAABBBounds(n):s.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){Bp(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,s),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||this.updateHTMLTextAABBBounds(t,e,i),Ko(i,i,s.transMatrix),i}updatePathAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePathAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePathAABBBoundsImprecise(t,e,i,s){if(!s)return i;const n=s.getParsedPathShape();return i.union(n.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;s.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updateArc3dAABBBounds(t,e,i,s){if(!s)return i;const n=s.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,s),i}updatePolygonAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||this.updatePolygonAABBBoundsImprecise(t,e,i,s);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updatePolygonAABBBoundsImprecise(t,e,i,s){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,s):this.updateLineAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;this.updatePathProxyAABBBounds(i,s)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,s):this.updateAreaAABBBoundsByPoints(t,e,i,s));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,s),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateCircleAABBBoundsImprecise(t,e,i,n):this.updateCircleAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateCircleAABBBoundsImprecise(t,e,i,s){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i,s){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-n>Bo-To?i.set(-a,-a,a,a):du(n,r,a,i),i}updateArcAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateArcAABBBoundsImprecise(t,e,i,n):this.updateArcAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateArcAABBBoundsImprecise(t,e,i,s){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:o=e.innerPadding}=t;return n+=a,r-=o,nl){const t=h;h=l,l=t}return n<=To?i.set(0,0,0,0):Math.abs(l-h)>Bo-To?i.set(-n,-n,n,n):(du(h,l,n,i),du(h,l,r,i)),i}updateSymbolAABBBounds(t,e,i,s,n){if(!this._validCheck(t,e,i,n))return i;this.updatePathProxyAABBBounds(i,n)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i,n):this.updateSymbolAABBBoundsAccurate(t,e,i,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((s=>{s.updateBounds(t,e,r,n),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,n),i}updateSymbolAABBBoundsImprecise(t,e,i,s){const{size:n=e.size}=t;if(Aa(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,s){if(!s)return i;const{size:n=e.size}=t;return s.getParsedPath().bounds(n,i),i}updateImageAABBBounds(t,e,i,s){if(!this._validCheck(t,e,i,s))return i;if(!this.updatePathProxyAABBBounds(i,s)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._imageBoundsContribitions.length&&this._imageBoundsContribitions.forEach((a=>{a.updateBounds(t,e,n,s),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Bp(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;Bp(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&&Ko(e,e,a)}_validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}};Xm=Nm([Hr(),Gm(0,jr(tg)),Vm("design:paramtypes",[Object])],Xm);const $m=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 qm,Zm;function Jm(t){return qm||(qm=$m.CreateGraphic("text",{})),qm.initAttributes(t),qm.AABBBounds}const Qm={x:0,y:0,z:0,lastModelMatrix:null};class tv{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===hh.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===hh.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=bg(o,l,n),p=Sg(o,c),g=yg(n,r),f=_g(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){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Qm.x=n,Qm.y=r,Qm.z=a,Qm.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=Hm.allocate(),n=Hm.allocate();Km(n,t,e),Ym(s,d||s,n),Qm.x=0,Qm.y=0,Qm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Hm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Qm.x+=s.x,Qm.y+=s.y,Qm.z=a,i.setTransformForCurrent()}else if(p)Qm.x=0,Qm.y=0,Qm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Qm.x+=s.x,Qm.y+=s.y,this.transformWithoutTranslate(i,Qm.x,Qm.y,Qm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Qm.x=0,Qm.y=0,Qm.z=0;return Qm}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,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;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){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Ed(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=bg(d,u,h),_=Sg(d,g),b=yg(h),x=_g(c,p);return!f||(!b&&!x||(!(y||_||a||o)||(e.beginPath(),gh(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):_&&(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())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&Hm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const ev=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&&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=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class iv{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(iv.IsGradientStr(t))try{const e=ev(t)[0];if(e){if("linear"===e.type)return iv.ParseLinear(e);if("radial"===e.type)return iv.ParseRadial(e);if("conic"===e.type)return iv.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Co/2,n=parseFloat(e.value)/180*Co-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Bo,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Co/2;let n="angular"===e.type?parseFloat(e.value)/180*Co:0;for(;n<0;)n+=Bo;for(;n>Bo;)n-=Bo;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function sv(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function nv(t,e,i,s,n){if(!e||!0===e)return"black";let r,a;if(Aa(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-s,p=h.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,s,n):"conical"===a.gradient?r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-s,d=o.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,s,n):"radial"===a.gradient&&(r=function(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-s,f=d.y1-n;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,s,n)),r||"orange")}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)}};class lv{constructor(){this.time=hh.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:y=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Ed(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,v,y),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,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=cd.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),cd.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const hv=new lv;let cv=class{constructor(t){this.subRenderContribitions=t,this.time=hh.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)}))}};cv=rv([Hr(),ov(0,jr(ia)),ov(0,Nr(Hg)),av("design:paramtypes",[Object])],cv);class dv{constructor(){this.time=hh.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=cd.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])),cd.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,Bo),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){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const uv=new dv;const pv=new class{constructor(){this.time=hh.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{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY}=t.attribute;let{innerRadius:M=l.innerRadius,outerRadius:w=l.outerRadius}=t.attribute;w+=v,M-=m;const T=!(!u||!u.stroke),C=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=sv(e,n,e.dpr),a=n/w;if(t.setAttributes({outerRadius:w+r,innerRadius:M-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),wg(t,e,i,s,w+r,M-r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(T){const n=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/A,(S-s)/k,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=p,r=sv(e,n,e.dpr),a=n/w;if(t.setAttributes({outerRadius:w-r,innerRadius:M+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),wg(t,e,i,s,w-r,M+r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(C){const n=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-s)/k,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}t.setAttributes({outerRadius:w,innerRadius:M,startAngle:y,endAngle:_})}},gv=uv,fv=hv;const mv=new class{constructor(){this.time=hh.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:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=sv(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,m+r,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const n=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,u,(b-i)/S,(x-s)/A,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=p,r=sv(e,n,e.dpr);if(e.beginPath(),e.arc(i,s,m-r,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const n=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,p,(b-i)/S,(x-s)/A,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},vv=uv,yv=hv;const _v=new class extends lv{constructor(){super(...arguments),this.time=hh.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},bv=Co/2;function xv(t,e,i,s,n,r){let a;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),wa(r,!0))a=[r=Ro(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:a=[0,0,0,0];break;case 1:e=Ro(t[0]),a=[e,e,e,e];break;case 2:case 3:e=Ro(t[0]),i=Ro(t[1]),a=[e,i,e,i];break;default:a=t,a[0]=Ro(a[0]),a[1]=Ro(a[1]),a[2]=Ro(a[2]),a[3]=Ro(a[3])}}else a=[0,0,0,0];if(s<0||a[0]+a[1]+a[2]+a[3]<1e-12)return t.rect(e,i,s,n);const[o,l,h,c]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],d=Math.min(s/2,n/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],v=[h[0]-u[2],h[1]],y=[h[0],h[1]-u[2]],_=[c[0]+u[3],c[1]],b=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!Qa(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-bv,0,!1)}if(t.lineTo(y[0],y[1]),!Qa(v,y)){const e=y[0]-u[2],i=y[1];t.arc(e,i,u[2],0,bv,!1)}if(t.lineTo(_[0],_[1]),!Qa(_,b)){const e=_[0],i=_[1]-u[3];t.arc(e,i,u[3],bv,Co,!1)}if(t.lineTo(g[0],g[1]),!Qa(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],Co,Co+bv,!1)}return t.closePath(),t}var Sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class Av{constructor(){this.time=hh.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,opacity:v=l.opacity,x:y=l.x,y:_=l.y,scaleX:b=l.scaleX,scaleY:x=l.scaleY,x1:S,y1:A}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:S-i)||0,M=(null!=M?M:A-s)||0;const w=!(!u||!u.stroke),T=!(!p||!p.stroke);if(g){const{distance:n=l.outerBorder.distance}=u,r=sv(e,n,e.dpr),a=i-r,o=s-r,h=2*r;if(0===m||Aa(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(a,o,k+h,M+h)):(e.beginPath(),xv(e,a,o,k+h,M+h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(w){const n=l.outerBorder.opacity;l.outerBorder.opacity=v,e.setStrokeStyle(t,u,(y-i)/b,(_-s)/x,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(f){const{distance:n=l.innerBorder.distance}=p,r=sv(e,n,e.dpr),a=i+r,o=s+r,h=2*r;if(0===m||Aa(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(a,o,k-h,M-h)):(e.beginPath(),xv(e,a,o,k-h,M-h,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(T){const n=l.innerBorder.opacity;l.innerBorder.opacity=v,e.setStrokeStyle(t,p,(y-i)/b,(_-s)/x,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}}let kv=class{constructor(){this.time=hh.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)}};kv=Sv([Hr()],kv);let Mv=class{constructor(){this.time=hh.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}=t.attribute;let{width:v,height:y}=t.attribute;if(v=(null!=v?v:u-g)||0,y=(null!=y?y:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+v,s):e.moveTo(i+v,s),m[1]?e.lineTo(i+v,s+y):e.moveTo(i+v,s+y),m[2]?e.lineTo(i,s+y):e.moveTo(i,s+y),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Mv=Sv([Hr()],Mv);const wv=new Av,Tv=uv,Cv=hv;const Ev=new class extends Av{constructor(){super(...arguments),this.time=hh.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)}},Pv=new class extends lv{constructor(){super(...arguments),this.time=hh.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Ed(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(ya(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=lu(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return wa(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?xv(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const Bv=new class{constructor(){this.time=hh.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:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,A=!(!p||!p.stroke),k=!(!g||!g.stroke);if(f){const{distance:n=l.outerBorder.distance}=p,r=sv(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(A){const n=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,p,(_-i)/x,(b-s)/S,l.outerBorder),l.outerBorder.opacity=n,e.stroke()}}if(m){const{distance:n=l.innerBorder.distance}=g,r=sv(e,n,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,v,i,s,-r)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(k){const n=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,g,(_-i)/x,(b-s)/S,l.innerBorder),l.innerBorder.opacity=n,e.stroke()}}}},Rv=uv,Lv=hv;var Ov=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dv=function(t,e){return function(i,s){e(i,s,t)}};let Fv=class extends tv{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=zp,this.builtinContributions=[pv,fv,gv],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=Ro(d-c),p=d>c;let g=!1;if(nTo||w>To)&&(O=n*Oo(_),I=n*Fo(_),D=r*Oo(x),F=r*Fo(x),uTo){const t=Do(S,C),r=Do(A,C),a=Mg(D,F,P,B,n,t,Number(p)),o=Mg(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Lo(o.y11,o.x11),Lo(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>To)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>To){const t=Do(M,E),n=Do(k,E),a=Mg(R,L,O,I,r,-n,Number(p)),o=Mg(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&e.arc(i+a.cx,s+a.cy,n,Lo(a.y01,a.x01),Lo(a.y11,a.x11),!p);const t=Lo(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,p)}}else e.lineTo(i+r*Oo(x),s+r*Fo(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Ed(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:c=l.stroke,x:d=l.x,y:u=l.y}=t.attribute,p=this.valid(t,l,a,o);if(!p)return;const{fVisible:g,sVisible:f,doFill:m,doStroke:v}=p,{outerPadding:y=l.outerPadding,innerPadding:_=l.innerPadding,cap:b=l.cap,forceShowCap:x=l.forceShowCap}=t.attribute;let{outerRadius:S=l.outerRadius,innerRadius:A=l.innerRadius}=t.attribute;S+=y,A-=_;let k=0;const M=(ga(b)&&b||b[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ro(s-i){var e;let i=!0;if(ga(t,!0)){for(let s=0;s<4;s++)au[s]=t,i&&(i=!(null!==(e=au[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)au[e]=!!t[e],i&&(i=!!au[e]);else au[0]=!1,au[1]=!1,au[2]=!1,au[3]=!1;return{isFullStroke:i,stroke:au}})(c);if((m||T)&&(e.beginPath(),wg(t,e,i,s,S,A),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,m,v,g,f,l,n,a,o),m&&(a?a(e,t.attribute,l):g&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),v&&T&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))),!T&&v&&(e.beginPath(),wg(t,e,i,s,S,A,C),w||this.beforeRenderStep(t,e,i,s,m,v,g,f,l,n,a,o),o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(ga(b)&&b||b[1])&&x){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ro(h-r)>=Bo-To){e.beginPath();const r=Math.abs(S-A)/2/S,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;if(this.drawArcTailCapPath(t,e,i,s,S,A,d,d+r),w||this.beforeRenderStep(t,e,i,s,m,v,g,f,l,n,a,o),m){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+=Bo;for(;i>Bo;)i-=Bo;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),Yu(o.color,l.color,h,!1)}(0,0,h,n);a||bg&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}v&&(o||f&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))}}this.afterRenderStep(t,e,i,s,m,v,g,f,l,n,a,o),M&&(h.startAngle+=k,h.endAngle+=k)}draw(t,e,i,s){const n=Ed(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};Fv=Ov([Hr(),Dv(0,jr(ia)),Dv(0,Nr(Pg)),Iv("design:paramtypes",[Object])],Fv);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},zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hv=function(t,e){return function(i,s){e(i,s,t)}};let Nv=class extends tv{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Vp,this.builtinContributions=[mv,yv,vv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ed(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:f,sVisible:m,doFill:v,doStroke:y}=g;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,y,f,m,l,n,a,o),v&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill())),y&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,y,f,m,l,n,a,o)}draw(t,e,i,s){const n=Ed(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Vv(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]=_h(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 Gv(t,e,i,s,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=n||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((s,n)=>{var r;let h=s.p0;if(s.originP1!==s.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),s.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:n}=s;let c;if(e&&!1!==e.defined?c=h:e&&!1!==n.defined&&(c=null!==(r=s.p3)&&void 0!==r?r:s.p1),i){i=!i;const e=c?c.x:s.p0.x,n=c?c.y:s.p0.y;t.moveTo(e+a,n+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=s}else e=s}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),Vv(t,e,1,n),p=!1):p=!0}));return}if(i<=0)return;let f;"x"===s?f=oh.ROW:"y"===s?f=oh.COLUMN:"auto"===s&&(f=e.direction);const m=i*e.tryUpdateLength(f);let v=0,y=!0,_=null;for(let e=0,i=g.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Uv=class extends tv{constructor(){super(...arguments),this.numberType=Yp}draw(t,e,i,s){const n=Ed(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,m,v,y,_;if(!e)return;t.beginPath();const b=null!==(f=this.z)&&void 0!==f?f:0;Gv(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:b}),u.cache&&!Aa(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:x=0,x:S=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,x-c,S-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,x-c,S-d,o),t.stroke()));let{connectedType:A,connectedX:k,connectedY:M,connectedStyle:w}=a;if(Aa(o)?(A=null!==(m=null!=A?A:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,k=null!==(v=null!=k?k:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,M=null!==(y=null!=M?M:o[0].connectedY)&&void 0!==y?y:o[1].connectedY,w=null!==(_=null!=w?w:o[0].connectedStyle)&&void 0!==_?_:o[1].connectedStyle):(A=null!=A?A:o.connectedType,k=null!=k?k:o.connectedX,M=null!=M?M:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Gv(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:b,drawConnect:!0,mode:A,zeroX:k,zeroY:M});const f=[];Aa(o)?o.forEach((t=>f.push(t))):f.push(o),f.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,w,x-c,S-d,f),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,w,x-c,S-d,f),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===m)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Wh(t.points,m,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===m){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Do(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,y,i,s,t,a,o)}};function Yv(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function Kv(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),Vv(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),Vv(t,l,1,s),o=!1):o=!0}t.closePath()}Uv=Wv([Hr()],Uv);const Xv=new class extends dv{constructor(){super(...arguments),this.time=hh.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:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:fu(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:fu(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:fu(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:fu(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}},$v=hv;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)}};function Qv(t,e,i){switch(e){case"linear":default:return Ch(t,i);case"basis":return Bh(t,i);case"monotoneX":return jh(t,i);case"monotoneY":return zh(t,i);case"step":return Nh(t,.5,i);case"stepBefore":return Nh(t,0,i);case"stepAfter":return Nh(t,1,i);case"linearClosed":return Gh(t,i)}}let ty=class extends tv{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Np,this.builtinContributions=[Xv,$v],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m,v;const{points:y}=t.attribute;if(y.length<2)return;e.beginPath();const _=null!==(p=this.z)&&void 0!==p?p:0,b=y[0];e.moveTo(b.x+a,b.y+o,_);for(let t=1;t=0;t--){const i=y[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,_)}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:x=0,x:S=0}=t.attribute;if(!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,x-a,S-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),s){const{stroke:i=l&&l.stroke}=t.attribute;if(Aa(i)&&(i[0]||i[2])&&!1===i[1])if(e.beginPath(),i[0]){e.moveTo(b.x+a,b.y+o,_);for(let t=1;t=0;t--){const i=y[t];e.lineTo((null!==(m=i.x1)&&void 0!==m?m:i.x)+a,(null!==(v=i.y1)&&void 0!==v?v:i.y)+o,_)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,x-a,S-o,l),e.stroke())}}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Ed(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:w}=t.attribute;let{curveType:T=g.curveType}=t.attribute;if(k&&"linear"===T&&(T="linearClosed"),1===A&&!w&&!M.some((t=>!1===t.defined))&&"linear"===T)return this.drawLinearAreaHighPerformance(t,e,!!f,S,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const s=w.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Qv(t.points,T,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Qv(i,"stepBefore"===T?"stepAfter":"stepAfter"===T?"stepBefore":T),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=Qv(e,T),n=Qv(i,"stepBefore"===T?"stepAfter":"stepAfter"===T?"stepBefore":T);t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,_,r[c],[g,t.attribute],A,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,x,v,S,_,r[u],[g,t.attribute],Do(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,_,t.attribute,g,A,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Ed(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){let m=!1;return m=m||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,f),m=m||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,f),m}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v,y,_,b;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:x,connectedX:S,connectedY:A,connectedStyle:k}=a;const M=[];if(g&&(Aa(o)?(x=null!==(v=null!=x?x:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,S=null!==(y=null!=S?S:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,A=null!==(_=null!=A?A:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,k=null!==(b=null!=k?k:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(x=null!=x?x:o.connectedType,S=null!=S?S:o.connectedX,A=null!=A?A:o.connectedY,k=null!=k?k:o.connectedStyle),"connect"!==x&&"zero"!==x&&(x="none"),Aa(o)?o.forEach((t=>M.push(t))):M.push(o),M.push(a)),g&&"none"===x)return!1;t.beginPath();const{points:w,segments:T}=u.attribute;let C,E,P=oh.ROW;if(T){const t=T[T.length-1];E=T[0].points[0],C=t.points[t.points.length-1]}else E=w[0],C=w[w.length-1];const B=Ro(C.x-E.x),R=Ro(C.y-E.y);P=Number.isFinite(B+R)?B>R?oh.ROW:oh.COLUMN:oh.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),Yv(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),Yv(t,e,i,s),e.length=0,i.length=0)}n=o})),Yv(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?oh.ROW:oh.COLUMN,Number.isFinite(u)||(h=oh.COLUMN),Number.isFinite(p)||(h=oh.ROW);const g=i*(h===oh.ROW?u:p);let f=0,m=!0;const v=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ry=function(t,e){return function(i,s){e(i,s,t)}};let ay=class extends tv{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=Kp,this.builtinContributions=[iy,ey],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:Ed(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;if(e.beginPath(),t.pathShape)gh(t.pathShape.commandList,e,i,s,1,1,g);else{gh((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,_,m,v,d,n,a,o),_&&(o?o(e,t.attribute,d):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke())),y&&(a?a(e,t.attribute,d):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill())),this.afterRenderStep(t,e,i,s,y,_,m,v,d,n,a,o)}draw(t,e,i,s){const n=Ed(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};ay=sy([Hr(),ry(0,jr(ia)),ry(0,Nr(Ig)),ny("design:paramtypes",[Object])],ay);var oy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hy=function(t,e){return function(i,s){e(i,s,t)}};let cy=class extends tv{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=$p,this.builtinContributions=[wv,Cv,Tv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Ed(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:y=h.visible,x1:_,y1:b,x:x=h.x,y:S=h.y}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:_-x)||0,k=(null!=k?k:b-S)||0;const M=xg(g,f,A,k,c),w=Ag(g,v,A,k),T=yg(c,d),C=_g(u,m);if(!t.valid||!y)return;if(!T&&!C)return;if(!(M||w||a||o||d))return;0===p||Aa(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,A,k)):(e.beginPath(),xv(e,i,s,A,k,p));const E={doFill:T,doStroke:C};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,T,C,M,w,h,n,a,o,E),E.doFill&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,x-i,S-s,h),e.fill())),E.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,x-i,S-s,h),e.stroke())),this.afterRenderStep(t,e,i,s,T,C,M,w,h,n,a,o)}draw(t,e,i,s){const n=Ed(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};cy=oy([Hr(),hy(0,jr(ia)),hy(0,Nr(Fg)),ly("design:paramtypes",[Object])],cy);var dy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},py=function(t,e){return function(i,s){e(i,s,t)}};let gy=class extends tv{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Zp,this.builtinContributions=[Bv,Lv,Rv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Ed(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,b=t.getParsedPath();if(!b)return;const{keepDirIn3d:x=h.keepDirIn3d}=t.attribute,S=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),x&&e.camera&&e.project){const n=e.project(i,s,S),r=e.camera;e.camera=null,!1===b.draw(e,Aa(c)?[c[0]*p,c[1]*g]:c*p,n.x,n.y,void 0,((n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.fill)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath(),e.camera=r}else!1===b.draw(e,c,i,s,S,((n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill())),r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))}))&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,y,_,m,v,h,n,a,o),y&&!b.isSvg&&(a?a(e,t.attribute,h):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill())),_&&!b.isSvg&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke())),this.afterRenderStep(t,e,i,s,y,_,m,v,h,n,a,o)}draw(t,e,i,s){const n=Ed(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};gy=dy([Hr(),py(0,jr(ia)),py(0,Nr(jg)),uy("design:paramtypes",[Object])],gy);const fy=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new $o)}allocate(t,e,i,s){if(!this.pools.length)return(new $o).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 $o(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const my=new class extends lv{constructor(){super(...arguments),this.time=hh.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,g,f,m,v,y,_,b,x;const{backgroundMode:S=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let k,{background:M}=t.attribute;if(!M)return;const w=()=>{"richtext"===t.type&&(e.restore(),e.save(),k&&e.setTransformFromMatrix(k,!0,1))};let T;"richtext"===t.type&&(k=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const C=ya(M)&&M.background,E=t.transMatrix.onlyTranslate();if(C){const e=t.AABBBounds,i=(null!==(u=M.x)&&void 0!==u?u:e.x1)+(null!==(p=M.dx)&&void 0!==p?p:0),s=(null!==(g=M.y)&&void 0!==g?g:e.y1)+(null!==(f=M.dy)&&void 0!==f?f:0),n=null!==(m=M.width)&&void 0!==m?m:e.width(),r=null!==(v=M.height)&&void 0!==v?v:e.height();if(T=fy.allocate(i,s,i+n,s+r),M=M.background,!E){const t=T.width(),e=T.height();T.set((null!==(y=M.x)&&void 0!==y?y:0)+(null!==(_=M.dx)&&void 0!==_?_:0),(null!==(b=M.y)&&void 0!==b?b:0)+(null!==(x=M.dy)&&void 0!==x?x:0),t,e)}}else T=t.AABBBounds,E||(T=Jm(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(M);if("success"!==n.state||!n.data)return void w();e.highPerformanceSave(),E&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,T,S,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=M,n?(xv(e,T.x1,T.y1,T.width(),T.height(),n),e.fill()):e.fillRect(T.x1,T.y1,T.width(),T.height()),e.highPerformanceRestore()}C&&fy.free(T),w()}};var vy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yy=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 by=class extends tv{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Jp,this.builtinContributions=[my],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Ed(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,whiteSpace:v=d.whiteSpace,fontSize:y=d.fontSize,verticalMode:_=d.verticalMode,x:b=d.x,y:x=d.y}=t.attribute;let{textAlign:S=d.textAlign,textBaseline:A=d.textBaseline}=t.attribute;if(!_&&"vertical"===m){const e=S;S=null!==(l=t.getBaselineMapAlign()[A])&&void 0!==l?l:"left",A=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=yu(t.attribute.lineHeight,y))&&void 0!==c?c:y,M=this.valid(t,d,a,o);if(!M)return;const{fVisible:w,sVisible:T,doFill:C,doStroke:E}=M,P=!f,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,E,w,T,d,n,a,o),P&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=y;const t=zm.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),zm.free(t)}E&&(o?o(e,t.attribute,d):T&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):w&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;E&&(o?o(e,t.attribute,d):T&&(e.setStrokeStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):w&&(e.setCommonStyle(t,t.attribute,b-i,x-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawMultiUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=y,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*y,B,n.width,d,e)}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Io(e,r)}));let a=0,o=0;"bottom"===A?o=-n:"middle"===A&&(o=-n/2),"center"===S?a-=r/2:"right"===S&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===S?l+=s/2:"right"===S&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===m){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;k!==y&&("top"===A?s=(k-y)/2:"middle"===A||"bottom"===A&&(s=-(k-y)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===A?a=-k:"middle"===A&&(a=-k/2),"center"===S?n-=r/2:"right"===S&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}P&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,E,w,T,d,n,a,o)}draw(t,e,i,s){const n=Ed(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,underlineOffset:p=a.underlineOffset,underlineDash:g=a.underlineDash,fillOpacity:f=a.fillOpacity}=i.attribute,m=i.clipedWidth,v=Ug(l,m),y=Yg(h,c,c),_={lineWidth:0,stroke:d,opacity:u,strokeOpacity:f};if(t){_.lineWidth=t,o.setStrokeStyle(i,_,s,n,a),g&&o.setLineDash(g),o.beginPath();const e=n+y+c+p;o.moveTo(s+v,e,r),o.lineTo(s+v+m,e,r),o.stroke()}if(e){_.lineWidth=e,o.setStrokeStyle(i,_,s,n,a),o.beginPath();const t=n+y+c/2;o.moveTo(s+v,t,r),o.lineTo(s+v+m,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{fontSize:h=o.fontSize,fill:c=o.fill,opacity:d=o.opacity,underlineOffset:u=o.underlineOffset,underlineDash:p=o.underlineDash,fillOpacity:g=o.fillOpacity}=i.attribute,f=Yg("alphabetic",h,h),m={lineWidth:0,stroke:c,opacity:d,strokeOpacity:g};let v=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,s,n,o),p&&l.setLineDash(p),l.beginPath();const e=n+f+h+v+u;l.moveTo(s+0,e,r),l.lineTo(s+0+a,e,r),l.stroke()}if(v=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,s,n,o),l.beginPath();const t=n+f+h/2+v;l.moveTo(s+0,t,r),l.lineTo(s+0+a,t,r),l.stroke()}}};function xy(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cy=function(t,e){return function(i,s){e(i,s,t)}};let Ey=class extends tv{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=Xp,this.builtinContributions=[My,ky],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ed(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:f,sVisible:m,doFill:v,doStroke:y}=g;e.beginPath(),c<=0||Aa(c)&&c.every((t=>0===t))?xy(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void xy(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,y=v/m;const _=Sy(d,u),b=Sy(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Ay(h,y,_,d,u),A=Ay(h,y,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,w=Sy(k,M),T=Ay(h,Sy(y,v),w,k,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const E=Math.atan2(A.y-T.y,A.x-T.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,v,y,f,m,l,n,a,o),v&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill())),y&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,v,y,f,m,l,n,a,o)}draw(t,e,i,s){const n=Ed(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Ey=wy([Hr(),Cy(0,jr(ia)),Cy(0,Nr(Dg)),Ty("design:paramtypes",[Object])],Ey);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},By=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ry=function(t,e){return function(i,s){e(i,s,t)}};const Ly=["","repeat-x","repeat-y","repeat"];let Oy=class extends tv{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Up,this.builtinContributions=[Ev,Pv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ed(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:f=l.cornerRadius,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:y,sVisible:_,doFill:b,doStroke:x}=v;if(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,b,!1,y,!1,l,n,a),b)if(a)a(e,t.attribute,l);else if(y){if(!m||!t.resources)return;const n=t.resources.get(m);if("success"!==n.state)return;let r=!1;0===f||Aa(f)&&f.every((t=>0===t))||(e.beginPath(),xv(e,i,s,h,c,f),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Ly[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke())),this.afterRenderStep(t,e,i,s,b,!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&&Sa(s))return void hp.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Ed(t).image;this._draw(t,a,!1,i)}};Oy=Py([Hr(),Ry(0,jr(ia)),Ry(0,Nr(Og)),By("design:paramtypes",[Object])],Oy);const Iy=Symbol.for("IncrementalDrawContribution"),Dy=Symbol.for("ArcRender"),Fy=Symbol.for("AreaRender"),jy=Symbol.for("CircleRender"),zy=Symbol.for("GraphicRender"),Hy=Symbol.for("GroupRender"),Ny=Symbol.for("LineRender"),Vy=Symbol.for("PathRender"),Gy=Symbol.for("PolygonRender"),Wy=Symbol.for("RectRender"),Uy=Symbol.for("SymbolRender"),Yy=Symbol.for("TextRender"),Ky=Symbol.for("RichTextRender"),Xy=Symbol.for("GlyphRender"),$y=Symbol.for("ImageRender"),qy=Symbol.for("DrawContribution");var Zy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Qy=Symbol.for("DrawItemInterceptor"),t_=new $o,e_=new $o;class i_{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){t_.copy(s.dirtyBounds),e_.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(t_),s.backupDirtyBounds.copy(e_)),!0}}class s_{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 n_=class{constructor(){this.order=1,this.interceptors=[new i_,new a_,new r_,new s_]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===Hp,!e))),t.forEachChildren((t=>(n=!!t.findFace,!n))),e){const e=t.getChildren(),n=[...e];n.sort(((t,e)=>{var i,s,n,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(s=t.attribute.endAngle)&&void 0!==s?s:0))/2,o=((null!==(n=e.attribute.startAngle)&&void 0!==n?n:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Bo;for(;o<0;)o+=Bo;return o-a})),n.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),n.forEach((e=>{t.appendChild(e)}));const r=t.parent.globalTransMatrix;i.hack_pieFace="outside",s.renderGroup(t,i,r),i.hack_pieFace="inside",s.renderGroup(t,i,r),i.hack_pieFace="top",s.renderGroup(t,i,r),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(n){const e=t.getChildren(),n=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));n.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),n.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),n.forEach((e=>{t.add(e.g)})),s.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else s.renderGroup(t,i,t.parent.globalTransMatrix)}else s.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&Hm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}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)}};const c_=Symbol.for("RenderService");let d_=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};d_=o_([Hr(),h_(0,jr(qy)),l_("design:paramtypes",[Object])],d_);var u_=new Tr((t=>{t(c_).to(d_)}));const p_=Symbol.for("PickerService"),g_=Symbol.for("GlobalPickerService");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};const m_=Symbol.for("PickItemInterceptor");let v_=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=zm.allocateByObj(r),h=new Uo(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};v_=f_([Hr()],v_);let y_=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Uo(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}};y_=f_([Hr()],y_);let __=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===Hp,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Bo;for(;o<0;)o+=Bo;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),s.hack_pieFace="outside",a=e.pickGroup(t,i,n.parentMatrix,s),a.graphic||(s.hack_pieFace="inside",a=e.pickGroup(t,i,n.parentMatrix,s)),a.graphic||(s.hack_pieFace="top",a=e.pickGroup(t,i,n.parentMatrix,s)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,n.parentMatrix,s),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,n.parentMatrix,s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};__=f_([Hr()],__);var b_=new Tr(((t,e,i)=>{i(p_)||(t(g_).toSelf(),t(p_).toService(g_)),t(__).toSelf().inSingletonScope(),t(m_).toService(__),t(v_).toSelf().inSingletonScope(),t(m_).toService(v_),t(y_).toSelf().inSingletonScope(),t(m_).toService(y_),na(t,m_)})),x_=new Tr((t=>{t(Qp).to(Xm).inSingletonScope(),t(tg).toConstantValue($m)}));const S_=Symbol.for("AutoEnablePlugins"),A_=Symbol.for("PluginService");var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},M_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},w_=function(t,e){return function(i,s){e(i,s,t)}};let T_=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Bc.isBound(S_)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};T_=k_([Hr(),w_(0,jr(ia)),w_(0,Nr(S_)),M_("design:paramtypes",[Object])],T_);var C_=new Tr((t=>{t(A_).to(T_),function(t,e){t(ia).toDynamicValue((t=>{let{container:i}=t;return new sa(e,i)})).whenTargetNamed(e)}(t,S_)})),E_=new Tr((t=>{na(t,oa)})),P_=new Tr((t=>{t(Ec).to(Pc).inSingletonScope(),na(t,Ec)})),B_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},R_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let L_=class{constructor(){this.type="static",this.offscreen=!1,this.global=mc.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=Oc({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()}};L_=B_([Hr(),R_("design:paramtypes",[])],L_);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},I_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let D_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=mc.global}setDpr(t){}init(t,e,i){if(this.layer=t,this.window=e,i.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(t,e){}resizeView(t,e){}render(t,e,i){this.mainHandler.render(t,e,Object.assign(Object.assign({},i),{clear:!1}))}merge(t){}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return null}release(){}};D_=O_([Hr(),I_("design:paramtypes",[])],D_);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},j_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let z_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=mc.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Oc({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=s,this.context=s.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context,viewBox:e.stage.window.getViewBox(),transMatrix:e.stage.window.getViewBoxTransform()},e),{clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const s=t.getContext(),n=t.dpr,{viewBox:r}=i,a=r.x1,o=r.y1,l=r.width(),h=r.height();s.nativeContext.save(),s.nativeContext.setTransform(n,0,0,n,0,0),i.clear&&s.clearRect(a,o,l,h),s.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,a,o,l,h),s.nativeContext.restore()}merge(t){}};z_=F_([Hr(),j_("design:paramtypes",[])],z_);var H_=new Tr((t=>{t(L_).toSelf(),t(z_).toSelf(),t(D_).toSelf(),t(cg).toService(L_),t(dg).toService(z_),t(ug).toService(D_)}));var N_=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 V_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(n)o=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return o=!0,!0;return!1}),s)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),s),a.sort(((t,e)=>s?e-t:t-e));let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return N_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function W_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return a=!0,!0;return!1}),s);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;n[e]?n[e].push(t):(n[e]=[t],r.push(e))}),s),r.sort(((t,e)=>s?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),s);return o}var 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},Y_=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 X_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Xo,this.backupDirtyBounds=new Xo,this.global=mc.global,this.layerService=mc.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=Tl(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:ec.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:ec.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,zm.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=W_(e,i,ec.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&&!El(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=fy.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=zm.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):V_(t,ec.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),fy.free(n),zm.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||Bc.get(Iy);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},q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Z_=function(t,e){return function(i,s){e(i,s,t)}};let J_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Wp}drawShape(t,e,i,s,n,r,a,o){const l=Ed(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:_=l.path,lineWidth:b=l.lineWidth,visible:x=l.visible}=t.attribute,S=xg(u,m,p,g,h),A=Ag(u,v,p,g),k=yg(h,c),M=_g(d,b);if(!t.valid||!x)return;if(!f){if(!k&&!M)return;if(!(S||A||a||o||c))return}if(_&&_.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,_.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||Aa(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),xv(e,i,s,p,g,y));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(_v));const w={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===hh.beforeFillStroke&&r.drawShape(t,e,i,s,k,M,S,A,l,n,a,o,w)})),f&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w.doFill&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fill())),w.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===hh.afterFillStroke&&r.drawShape(t,e,i,s,k,M,S,A,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave(),n.baseGlobalAlpha*=a;const o=Ed(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=Hm.allocate(),i=Hm.allocate();Km(i,t,o),Ym(e,l||e,i),n.modelMatrix=e,Hm.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;let d;(h||c)&&n.translate(h,c),s&&s.drawingCb&&(d=s.drawingCb()),n.modelMatrix!==l&&Hm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};J_=$_([Hr(),Z_(0,jr(ia)),Z_(0,Nr(Lg)),q_("design:paramtypes",[Object])],J_);var Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let tb=class extends Uv{constructor(){super(...arguments),this.numberType=Yp}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=Ed(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=bg(u,p,c),y=Sg(u,g),_=yg(c),b=_g(d,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())}};tb=Q_([Hr()],tb);var eb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ib=class extends ty{constructor(){super(...arguments),this.numberType=Np}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=Ed(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=bg(u,d,c),f=yg(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())}};ib=eb([Hr()],ib);var sb,nb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ab=function(t,e){return function(i,s){e(i,s,t)}},ob=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"}(sb||(sb={}));let lb=class extends X_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=sb.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new aa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return ob(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:ec.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:ec.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 ob(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return ob(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>ob(this,void 0,void 0,(function*(){if(2!==t.count)yield G_(t,ec.zIndex,((i,s)=>{if(this.status===sb.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return ob(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return ob(this,void 0,void 0,(function*(){this.rendering&&(this.status=sb.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=sb.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 ob(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:()=>ob(this,void 0,void 0,(function*(){yield G_(t,ec.zIndex,(t=>ob(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};lb=nb([Hr(),ab(0,zr(zy)),ab(1,jr(tb)),ab(2,jr(ib)),ab(3,jr(ia)),ab(3,Nr(Qy)),rb("design:paramtypes",[Array,Object,Object,Object])],lb);var hb=new Tr((t=>{t(lv).toSelf().inSingletonScope(),t(dv).toSelf().inSingletonScope(),t(qy).to(X_),t(Iy).to(lb),t(Hy).to(J_).inSingletonScope(),t(zy).toService(Hy),na(t,Lg),t(cv).toSelf().inSingletonScope(),na(t,Hg),na(t,zy),t(n_).toSelf().inSingletonScope(),t(Qy).toService(n_),na(t,Qy)}));function cb(){cb.__loaded||(cb.__loaded=!0,Bc.load(vg),Bc.load(x_),Bc.load(u_),Bc.load(b_),Bc.load(C_),function(t){t.load(E_),t.load(P_),t.load(H_)}(Bc),function(t){t.load(hb)}(Bc))}cb.__loaded=!1,cb();const db=Bc.get(la);mc.global=db;const ub=Bc.get(lg);mc.graphicUtil=ub;const pb=Bc.get(og);mc.transformUtil=pb;const gb=Bc.get(Qp);mc.graphicService=gb;const fb=Bc.get(hg);mc.layerService=fb;class mb{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=wr.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,mc.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),mc.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){mc.graphicService.hooks.onAttributeUpdate.taps=mc.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),mc.graphicService.hooks.onSetStage.taps=mc.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class vb{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=wr.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const s=this.pluginService.stage;if(this.option3d||(this.option3d=s.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=n/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,s.set3dOptions(this.option3d),s.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class yb{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=wr.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,mc.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))})),mc.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){mc.graphicService.hooks.onAddIncremental.taps=mc.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),mc.graphicService.hooks.onClearIncremental.taps=mc.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,mc.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class _b{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=wr.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),mc.graphicService.hooks.onRemove.unTap(this.key),mc.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?mc.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:mc.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Vl(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=Vl(i);ma(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&Sa(t.fill)&&(e.color=t.fill),e}("text"===t.type&&t.attribute?t.attribute:Ed(t).text)}getTransformOfText(t){const e=Ed(t).text,{textAlign:i=e.textAlign,textBaseline:s=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=n,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[s]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[s]}`}}updateStyleOfWrapContainer(t,e,i,s,n){const{pointerEvents:r}=n;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===r?"all":r||"none",i.style.position||(i.style.position="absolute",s.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=n.anchorType;if(ma(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=Hl(h,c);o=t.x,l=t.y}const d=mc.global.getElementTopLeft(s,!1),u=e.window.getTopLeft(!1),p=o+u.left-d.left,g=l+u.top-d.top;if(a.left=`${p}px`,a.top=`${g}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),fa(n.style)){const e=n.style({top:g,left:p,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else ya(n.style)?a=Object.assign(Object.assign({},a),n.style):Sa(n.style)&&n.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),s=i[1].trim();e&&s&&(t[e]=s)}}})),t}(n.style)));mc.global.updateDom(i,{width:n.width,height:n.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===mc.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:ec.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:ec.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&mc.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const{dom:n,container:r}=i;if(!n)return;const a=ma(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof n?this.htmlMap[a].wrapContainer.innerHTML=n:n!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,r);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,s,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===mc.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const bb=new $o;class xb{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=wr.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()})),mc.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&&(bb.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(bb,t.parent&&t.parent.globalTransMatrix)))})),mc.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))})),mc.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){mc.graphicService.hooks.beforeUpdateAABBBounds.taps=mc.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),mc.graphicService.hooks.afterUpdateAABBBounds.taps=mc.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),mc.graphicService.hooks.onRemove.taps=mc.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Sb=new $o;class Ab{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=wr.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new $o}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Ed(i).group,{display:n=s.display}=i.attribute;if("flex"!==n)return;const{flexDirection:r=s.flexDirection,flexWrap:a=s.flexWrap,alignItems:o=s.alignItems,clip:l=s.clip}=i.attribute,{alignContent:h=(null!=o?o:s.alignContent)}=i.attribute;let{width:c,height:d,justifyContent:u=s.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==d){let t=0,e=0,i=0;if(p.forEach((s=>{const n=this.getAABBBounds(s);n.empty()||("column"===r||"column-reverse"===r?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.y2)})),!isFinite(i))return;c=t,d=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=d:d=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:d,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=d,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===u?u="flex-end":"flex-end"===u?u="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),s="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:s}),v+=i,y=Math.max(y,s)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach(((i,s)=>{let{mainLen:n,crossLen:r}=i;t+n>f.len?0===t?(b.push({idx:s,mainLen:t+n,crossLen:r}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=n,e=r):(t+=n,e=Math.max(e,r))})),b.push({idx:_.length-1,mainLen:t,crossLen:e})}else b.push({idx:_.length-1,mainLen:v,crossLen:y});let x=0;if(b.forEach((t=>{this.layoutMain(i,p,u,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const s={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,s,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,s)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[s],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,s,n,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=s.len;for(let i=a.idx;i>=r;i--){t-=n[i].mainLen;const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`]))}}else if("space-around"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=s.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}else{const t=a.idx-r+1,i=(s.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],s.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[s.field]=this.updateChildPos(r,e[t].attribute[s.field],a[`${s.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(s.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],s.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[s.field]=this.updateChildPos(r,e[i].attribute[s.field],a[`${s.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,s,n,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=s[a])&&void 0!==o?o:s["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,mc.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),mc.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&Sb.copy(s)})),mc.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(Sb.equals(i)||this.tryLayout(t,!1))})),mc.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){mc.graphicService.hooks.onAttributeUpdate.taps=mc.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),mc.graphicService.hooks.beforeUpdateAABBBounds.taps=mc.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),mc.graphicService.hooks.afterUpdateAABBBounds.taps=mc.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),mc.graphicService.hooks.onSetStage.taps=mc.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const kb=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===Yd.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=Yd.INITIAL,mc.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),mc.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:Ud},{mode:"timeout",cons:Wd},{mode:"manual",cons:Gd}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Yd.INITIAL&&(this.status=Yd.PAUSE,!0)}resume(){return this.status!==Yd.INITIAL&&(this.status=Yd.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===Yd.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Yd.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=Yd.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Yd.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};kb.addTimeline($d),kb.setFPS(60);class Mb{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=Wu.Get(e,Gu.Color1),this.ambient=i;const s=jo(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/s,t[1]/s,t[2]/s]}computeColor(t,e){const i=this.formatedDir,s=Do(Io((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=Sa(e)?Wu.Get(e,Gu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function wb(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],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Tb(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 Cb{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=Hm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Hm.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,s){let n,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],v=s[0],y=s[1],_=s[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b){e.unmount()})),i&&mc.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!(r&&n&&n.createRoot))return;const o=ma(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const Rb="white";class Lb extends ng{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:Rb}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new Td,this.hooks={beforeRender:new aa(["stage"]),afterRender:new aa(["stage"])},this.global=mc.global,!this.global.env&&Pb()&&this.global.setEnv("browser"),this.window=Bc.get(pd),this.renderService=Bc.get(c_),this.pluginService=Bc.get(A_),this.layerService=Bc.get(hg),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:Rb,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||kb,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new Xd,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&Sa(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){this._skipRender=-1}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Vd(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir: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(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1),this.light=new Mb(f,m,v);const k={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};this.camera?this.camera.params=k:this.camera=new Cb(k),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new vb))}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 mb))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new yb))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Xo;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new xb,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new Ab))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new _b))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){this.reactAttribute||(this.reactAttribute=t,this.pluginService.register(new Bb))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;this.pickerService||(this.pickerService=Bc.get(p_));const i=this.pickerService.pick(this.children,new Uo(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=Bc.get(pd),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}}var 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)};const Db=new il(1,0,0,1,0,0),Fb={x:0,y:0};let jb=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new il(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new il(1,0,0,1,0,0),this.path=new Uh,this._clearMatrix=new il(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return zm.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(zm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(zm.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Fb),function(t,e,i){return hd(t,0,!1,e,i)}(this.path.commandList,Fb.x,Fb.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Fb);const i=sv(this,this.lineWidth,this.dpr);return function(t,e,i,s){return hd(t,e,!0,i,s)}(this.path.commandList,i,Fb.x,Fb.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(Db,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>zm.free(t))),this.stack.length=0}};jb=Ob([Hr(),Ib("design:paramtypes",[Object,Number])],jb);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},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Nb={WIDTH:500,HEIGHT:500,DPR:1};let Vb=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Nb.WIDTH,height:n=Nb.HEIGHT,dpr:r=Nb.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};Vb.env="browser",Vb=zb([Hr(),Hb("design:paramtypes",[Object])],Vb);var Gb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<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{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new $o}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}}};Wb=Gb([Hr()],Wb);var Ub=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kb=class{constructor(){this._uid=wr.GenAutoIncrementId(),this.viewBox=new $o,this.modelMatrix=new il(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};Kb=Ub([Hr(),Yb("design:paramtypes",[])],Kb);var 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)},qb=function(t,e){return function(i,s){e(i,s,t)}};let Zb=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=mc.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new $o).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 il(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Hm.allocate();if(Um(i,e),a){if(i){const t=Hm.allocate();r.modelMatrix=Ym(t,a,i),Hm.free(i)}}else Um(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Uo(e.x,e.y),a=Ed(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 Uo(e.x,e.y);l.transformPoint(a,a);const o=Ed(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&&Hm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),zm.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function Jb(t,e,i,s,n){let r=s,a=e;const o=t[e].x,l=t[e].y,h=t[i].x-o,c=t[i].y-l,d=h*h+c*c;let u,p,g,f,m;for(let s=e+1,n=i-1;sr&&(r=g,a=s);r>s&&(a-e>2&&Jb(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&Jb(t,a,i,s,n))}function Qb(t,e){const i=t.length-1,s=[t[0]];return Jb(t,0,i,e,s),s.push(t[i]),s}Zb=Xb([Hr(),qb(0,jr(ia)),qb(0,Nr(m_)),$b("design:paramtypes",[Object])],Zb);let tx=!1;const ex=new Tr((t=>{tx||(tx=!0,t(Fv).toSelf().inSingletonScope(),t(Dy).to(Fv).inSingletonScope(),t(zy).toService(Dy),t(Pg).toService(cv),na(t,Pg))}));let ix=!1;const sx=new Tr((t=>{ix||(ix=!0,t(cy).toSelf().inSingletonScope(),t(Wy).to(cy).inSingletonScope(),t(zy).toService(Wy),t(Mv).toSelf(),t(kv).toSelf(),t(Fg).toService(Mv),t(Fg).toService(kv),t(Fg).toService(cv),na(t,Fg))}));let nx=!1;const rx=new Tr((t=>{nx||(nx=!0,t(Uv).toSelf().inSingletonScope(),t(tb).toSelf().inSingletonScope(),t(Ny).to(Uv).inSingletonScope(),t(zy).toService(Ny))}));let ax=!1;const ox=new Tr((t=>{ax||(ax=!0,t(ty).toSelf().inSingletonScope(),t(Fy).to(ty).inSingletonScope(),t(zy).toService(Fy),t(Bg).toService(cv),na(t,Bg),t(ib).toSelf().inSingletonScope())}));let lx=!1;const hx=new Tr((t=>{lx||(lx=!0,t(gy).toSelf().inSingletonScope(),t(Uy).to(gy).inSingletonScope(),t(zy).toService(Uy),t(jg).toService(cv),na(t,jg))}));let cx=!1;const dx=new Tr((t=>{cx||(cx=!0,t(Nv).toSelf().inSingletonScope(),t(jy).to(Nv).inSingletonScope(),t(zy).toService(jy),t(Rg).toService(cv),na(t,Rg))}));let ux=!1;const px=new Tr((t=>{ux||(ux=!0,t(Yy).to(by).inSingletonScope(),t(zy).toService(Yy),t(zg).toService(cv),na(t,zg))}));let gx=!1;const fx=new Tr((t=>{gx||(gx=!0,t(ay).toSelf().inSingletonScope(),t(Vy).to(ay).inSingletonScope(),t(zy).toService(Vy),t(Ig).toService(cv),na(t,Ig))}));let mx=!1;const vx=new Tr((t=>{mx||(mx=!0,t(Gy).to(Ey).inSingletonScope(),t(zy).toService(Gy),t(Dg).toService(cv),na(t,Dg))}));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};let _x=class{constructor(){this.numberType=Gp}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=Ed(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};_x=yx([Hr()],_x);let bx=!1;const xx=new Tr((t=>{bx||(bx=!0,t(Xy).to(_x).inSingletonScope(),t(zy).toService(Xy))}));var Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kx=class extends tv{constructor(){super(),this.numberType=qp,this.builtinContributions=[my],this.init()}drawShape(t,e,i,s,n){const r=Ed(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=bg(o,l,!0),d=bg(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Ed(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],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(),xv(e,i-t,s-n,v,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,s,o,l))}draw(t,e,i){const s=Ed(t).richtext;this._draw(t,s,!1,i)}};kx=Sx([Hr(),Ax("design:paramtypes",[])],kx);let Mx=!1;const Tx=new Tr((t=>{Mx||(Mx=!0,t(Ky).to(kx).inSingletonScope(),t(zy).toService(Ky))}));let Cx=!1;const Ex=new Tr((t=>{Cx||(Cx=!0,t($y).to(Oy).inSingletonScope(),t(zy).toService($y),t(Og).toService(cv),na(t,Og))}));const Px=(t,e)=>(d(Rx.warnHandler)&&Rx.warnHandler.call(null,t,e),e?Z.getInstance().warn(`[VChart warn]: ${t}`,e):Z.getInstance().warn(`[VChart warn]: ${t}`)),Bx=(t,e,i)=>{if(!d(Rx.errorHandler))throw new Error(t);Rx.errorHandler.call(null,t,e)},Rx={silent:!1,warnHandler:!1,errorHandler:!1},Lx=Pb(),Ox=Lx&&globalThis?globalThis.document:void 0;function Ix(t){return("desktop-browser"===t||"mobile-browser"===t)&&Lx}function Dx(t){return Fx(t)||"mobile-browser"===t}function Fx(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let jx=0;function zx(){return jx>=9999999&&(jx=0),jx++}function Hx(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Nx(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}const Vx=(t,e,i)=>(t.fields=e||[],t.fname=i,t),Gx=t=>e=>Ia(e,t),Wx=t=>{lo.getInstance().error(t)},Ux=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(fa(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||Wx("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&Wx("Access path missing closing bracket: "+t),a&&Wx("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return Vx((i&&i.get||Gx)(s),[n],e||n)},Yx=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Aa(t)){const s=t.map((t=>Ux(t,e,i)));return t=>s.map((e=>e(t)))}return Ux(t,e,i)};Yx("id");const Kx=Vx((function(t){return t}),[],"identity"),Xx=Vx((function(){return 0}),[],"zero");Vx((function(){return 1}),[],"one"),Vx((function(){return!0}),[],"true"),Vx((function(){return!1}),[],"false"),Vx((function(){return{}}),[],"emptyObject");const $x=(t,e)=>{const i=fa(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(ma(e)||ma(i))return ma(e)&&ma(i);if(!_a(e)&&!_a(i))return e===i;const n=Aa(e)?e:e[t],r=Aa(i)?i:i[t];return n===r||!1!==s&&(Aa(r)?!(!Aa(n)||r.length!==n.length||!r.every(((t,e)=>t===n[e]))):!!ya(r)&&!(!ya(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every((t=>qx(t,r,n)))))},Zx=(t,e)=>ma(t)?e:Sa(t)?e*parseFloat(t)/100:t;function Jx(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!ma(n)&&(n=+n)>=n&&!ma(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Qx(t,e,i,s,n){let r=0,a=0;return Jx(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function tS(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;Jx(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Qx(t,e,i,n,h)}}function eS(t){return"horizontal"===t}function iS(t){return"vertical"===t}const sS=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class nS extends ng{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){ba(this.attribute[t])&&ba(e)&&!fa(this.attribute[t])&&!fa(e)?Va(this.attribute[t],e):this.attribute[t]=e,sS.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>sS.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){ma(e)&&(e=Object.keys(t));for(let i=0;i{const e=t.target,i=this.rootNode,s=e===i;if(e&&!s){let n,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!s){e.attribute.pickable=!1;const s=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==s&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),s&&(t.type="dragenter",t.target=s,s.dispatchEvent(t)),n=s,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const RS=(t,e)=>{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},LS=(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 OS extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.reset(),this.startTime=Fd.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Fd.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||RS(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=LS(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=Fd.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=LS(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=RS(i,n),this.triggerEvent("swipe",e))}}i-this.lastTapTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if(e)return e;let n;return n=Fd.now()-i>this.config.press.time&&LS(s[0],t){for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const FS=[0,0,0];let jS=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},$h),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Zh),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Jh),{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 il(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new il(1,0,0,1,0,0),this._clearMatrix=new il(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&lo.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new il(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return zm.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&&(zm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(zm.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Bo;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Eg.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&&(Tb(FS,[t,e,i],this.modelMatrix),t=FS[0],e=FS[1],i=FS[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&&(Tb(FS,[t,e,i],this.modelMatrix),t=FS[0],e=FS[1],i=FS[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Tb(FS,[e,i,s],this.modelMatrix),e=FS[0],i=FS[1],s=FS[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mc.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=mc.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Jh.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Jh.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&&(Tb(FS,[e,i,s],this.modelMatrix),e=FS[0],i=FS[1],s=FS[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o*this.baseGlobalAlpha,r.fillStyle=nv(this,l,t,i,s)):r.globalAlpha=a*o*this.baseGlobalAlpha}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=sv(this,l,this.dpr),r.strokeStyle=nv(this,h,t,i,s),r.lineJoin=c,d&&r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=Wg(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=Wg(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>zm.free(t))),this.stack.length=0}};jS.env="browser",jS=IS([Hr(),DS("design:paramtypes",[Object,Number])],jS);var zS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let NS=class extends Vb{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=mc.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new jS(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 VS(t,e){return new Tr((i=>{i(Rc).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lc).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}NS.env="browser",NS=zS([Hr(),HS("design:paramtypes",[Object])],NS);const GS=VS(NS,jS);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},US=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 KS=class extends Zb{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=cd.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 $S=class{constructor(){this.type="group",this.numberType=Wp}contains(t,e,i){return!1}};$S=XS([Hr()],$S);const qS=new Tr(((t,e,i,s)=>{qS.__vloaded||(qS.__vloaded=!0,t(ES).to($S).inSingletonScope(),t(PS).toService(ES),na(t,PS))}));qS.__vloaded=!1;var ZS=qS;const JS=new Tr(((t,e,i,s)=>{i(KS)||t(KS).toSelf().inSingletonScope(),i(p_)?s(p_).toService(KS):t(p_).toService(KS)}));var QS,tA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let iA=QS=class extends Kb{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${QS.idprefix}_${QS.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=mc.global,this.viewBox=new $o,this.modelMatrix=new il(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:QS.GenerateCanvasId(),canvasControled:!0};this.canvas=new NS(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 NS({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)}};iA.env="browser",iA.idprefix="visactor_window",iA.prefix_count=0,iA=QS=tA([Hr(),eA("design:paramtypes",[])],iA);const sA=new Tr((t=>{t(iA).toSelf(),t(gd).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},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class aA{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 oA(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let lA=class extends Wb{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)/(Ta(l)?l:1),y:(i-a.top)/(Ta(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 aA(t)}return new $o}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(Sa(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=Sa(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return oA(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return oA(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:wr.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};lA=nA([Hr(),rA("design:paramtypes",[])],lA);const hA=new Tr((t=>{hA.isBrowserBound||(hA.isBrowserBound=!0,t(lA).toSelf().inSingletonScope(),t(oa).toService(lA))}));function cA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];cA.__loaded||(cA.__loaded=!0,t.load(hA),t.load(GS),t.load(sA),e&&function(t){t.load(ZS),t.load(JS)}(t))}hA.isBrowserBound=!1,cA.__loaded=!1;var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,s){e(i,s,t)}};let gA=class extends Zb{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new jb(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}};gA=dA([Hr(),pA(0,jr(ia)),pA(0,Nr(rS)),pA(1,jr(ia)),pA(1,Nr(m_)),uA("design:paramtypes",[Object,Object])],gA);const fA=new Tr((t=>{fA.__vloaded||(fA.__vloaded=!0,na(t,rS))}));fA.__vloaded=!1;var mA=fA,vA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_A=function(t,e){return function(i,s){e(i,s,t)}};let bA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=zp}contains(t,e,i){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=Ed(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};bA=vA([Hr(),_A(0,jr(Dy)),yA("design:paramtypes",[Object])],bA);let xA=!1;const SA=new Tr(((t,e,i,s)=>{xA||(xA=!0,t(aS).to(bA).inSingletonScope(),t(rS).toService(aS))}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kA=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 wA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=Np}contains(t,e,i){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=Ed(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),s.highPerformanceRestore(),o}};wA=AA([Hr(),MA(0,jr(Fy)),kA("design:paramtypes",[Object])],wA);let TA=!1;const CA=new Tr(((t,e,i,s)=>{TA||(TA=!0,t(oS).to(wA).inSingletonScope(),t(rS).toService(oS))}));var EA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BA=function(t,e){return function(i,s){e(i,s,t)}};let RA=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=Vp}contains(t,e,i){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=Ed(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};RA=EA([Hr(),BA(0,jr(jy)),PA("design:paramtypes",[Object])],RA);let LA=!1;const OA=new Tr(((t,e,i,s)=>{LA||(LA=!0,t(lS).to(RA).inSingletonScope(),t(rS).toService(lS))}));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},DA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FA=function(t,e){return function(i,s){e(i,s,t)}};let jA=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=Gp}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{s||(s=!!n.pickItem(t,e,null,i))})),s}return!1}};jA=IA([Hr(),FA(0,jr(Xy)),DA("design:paramtypes",[Object])],jA);let zA=!1;const HA=new Tr(((t,e,i,s)=>{zA||(zA=!0,t(mS).to(jA).inSingletonScope(),t(jA).toService(mS))}));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 VA=class{constructor(){this.type="image",this.numberType=Up}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};VA=NA([Hr()],VA);let GA=!1;const WA=new Tr(((t,e,i,s)=>{GA||(GA=!0,t(hS).to(VA).inSingletonScope(),t(VA).toService(hS))}));var UA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KA=function(t,e){return function(i,s){e(i,s,t)}};let XA=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=Yp}contains(t,e,i){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=Ed(t).line;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};XA=UA([Hr(),KA(0,jr(Ny)),YA("design:paramtypes",[Object])],XA);let $A=!1;const qA=new Tr(((t,e,i,s)=>{$A||($A=!0,t(cS).to(XA).inSingletonScope(),t(rS).toService(cS))}));var ZA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QA=function(t,e){return function(i,s){e(i,s,t)}};let tk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=Xp}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Ed(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};tk=ZA([Hr(),QA(0,jr(Gy)),JA("design:paramtypes",[Object])],tk);let ek=!1;const ik=new Tr(((t,e,i,s)=>{ek||(ek=!0,t(fS).to(tk).inSingletonScope(),t(rS).toService(fS))}));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},nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rk=function(t,e){return function(i,s){e(i,s,t)}};let ak=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=Kp}contains(t,e,i){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=Ed(t).path;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};ak=sk([Hr(),rk(0,jr(Vy)),nk("design:paramtypes",[Object])],ak);let ok=!1;const lk=new Tr(((t,e,i,s)=>{ok||(ok=!0,t(dS).to(ak).inSingletonScope(),t(rS).toService(dS))}));var hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dk=function(t,e){return function(i,s){e(i,s,t)}};const uk=new $o;let pk=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=$p}contains(t,e,i){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=Ed(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||wa(r,!0)&&0!==r||Aa(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;uk.setValue(i.x1,i.y1,i.x2,i.y2),uk.expand(-r/2),h=!uk.containsPoint(e)}}return s.highPerformanceRestore(),h}};pk=hk([Hr(),dk(0,jr(Wy)),ck("design:paramtypes",[Object])],pk);let gk=!1;const fk=new Tr(((t,e,i,s)=>{gk||(gk=!0,t(uS).to(pk).inSingletonScope(),t(rS).toService(uS))}));let mk=!1;const vk=new Tr(((t,e,i,s)=>{mk||(mk=!0,t(hS).to(VA).inSingletonScope(),t(VA).toService(hS))}));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},_k=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=Zp}contains(t,e,i){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=Ed(t).symbol;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=r+a,o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};xk=yk([Hr(),bk(0,jr(Uy)),_k("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new Tr(((t,e,i,s)=>{Sk||(Sk=!0,t(pS).to(xk).inSingletonScope(),t(rS).toService(pS))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Mk=class{constructor(){this.type="text",this.numberType=Jp}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Mk=kk([Hr()],Mk);let wk=!1;const Tk=new Tr(((t,e,i,s)=>{wk||(wk=!0,t(gS).to(Mk).inSingletonScope(),t(rS).toService(gS))})),Ck=new Tr(((t,e,i,s)=>{i(gA)||t(gA).toSelf().inSingletonScope(),i(p_)?s(p_).toService(gA):t(p_).toService(gA)}));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},Pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Bk=class extends jS{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 il(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};Bk.env="node",Bk=Ek([Hr(),Pk("design:paramtypes",[Object,Number])],Bk);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},Lk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ok=class extends Vb{constructor(t){super(t)}init(){this._context=new Bk(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&fa(this._nativeCanvas.release)&&this._nativeCanvas.release()}};Ok.env="node",Ok=Rk([Hr(),Lk("design:paramtypes",[Object])],Ok);const Ik=VS(Ok,Bk);var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class extends Kb{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:wr.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new Ok(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new Ok({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};zk.env="node",zk=Dk([Hr(),jk(0,jr(la)),Fk("design:paramtypes",[Object])],zk);const Hk=new Tr((t=>{t(zk).toSelf(),t(gd).toDynamicValue((t=>t.container.get(zk))).whenTargetNamed(zk.env)}));var Nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vk=class extends Wb{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 vu.call(t)}}getCancelAnimationFrame(){return t=>{vu.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};Vk=Nk([Hr()],Vk);const Gk=new Tr((t=>{Gk.isNodeBound||(Gk.isNodeBound=!0,t(Vk).toSelf().inSingletonScope(),t(oa).toService(Vk))}));function Wk(t){Wk.__loaded||(Wk.__loaded=!0,t.load(Gk),t.load(Ik),t.load(Hk))}Gk.isNodeBound=!1,Wk.__loaded=!1;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};let Yk=class extends jS{draw(){}createPattern(t,e){return null}};Yk.env="wx",Yk=Uk([Hr()],Yk);var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $k=class extends Vb{constructor(t){super(t)}init(){this._context=new Yk(this,this._dpr)}release(){}};$k.env="wx",$k=Kk([Hr(),Xk("design:paramtypes",[Object])],$k);const qk=VS($k,Yk);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)},Qk=function(t,e){return function(i,s){e(i,s,t)}};class tM{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 eM=class extends Kb{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new tM}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:wr.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new $k(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 $k({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()}};eM.env="wx",eM=Zk([Hr(),Qk(0,jr(la)),Jk("design:paramtypes",[Object])],eM);const iM=new Tr((t=>{t(eM).toSelf(),t(gd).toDynamicValue((t=>t.container.get(eM))).whenTargetNamed(eM.env)}));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},nM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rM=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 aM=class extends Wb{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,s,n,r){return rM(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=s&&n.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return vu.call(t)}}getCancelAnimationFrame(){return t=>{vu.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};aM=sM([Hr(),nM("design:paramtypes",[])],aM);const oM=new Tr((t=>{oM._isWxBound||(oM._isWxBound=!0,t(aM).toSelf().inSingletonScope(),t(oa).toService(aM))}));function lM(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];lM.__loaded||(lM.__loaded=!0,t.load(oM),t.load(qk),t.load(iM),e&&function(t){t.load(mA),t.load(Ck),t.load(SA),t.load(CA),t.load(OA),t.load(HA),t.load(WA),t.load(qA),t.load(ik),t.load(lk),t.load(fk),t.load(vk),t.load(Ak),t.load(Tk)}(t))}oM._isWxBound=!1,lM.__loaded=!1;var hM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dM=function(t,e){return function(i,s){e(i,s,t)}};let uM=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=zp}contains(t,e,i){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=Ed(t).arc;s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=sv(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};uM=hM([Hr(),dM(0,jr(Dy)),cM("design:paramtypes",[Object])],uM);let pM=!1;const gM=new Tr(((t,e,i,s)=>{pM||(pM=!0,t(vS).to(uM).inSingletonScope(),t(PS).toService(vS))}));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},mM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vM=function(t,e){return function(i,s){e(i,s,t)}};const yM=new $o;let _M=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=$p}contains(t,e,i){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=Ed(t).rect,{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||wa(r,!0)&&0!==r||Aa(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=sv(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;yM.setValue(i.x1,i.y1,i.x2,i.y2),yM.expand(-r/2),h=!yM.containsPoint(e)}}return s.highPerformanceRestore(),h}};_M=fM([Hr(),vM(0,jr(Wy)),mM("design:paramtypes",[Object])],_M);let bM=!1;const xM=new Tr(((t,e,i,s)=>{bM||(bM=!0,t(AS).to(_M).inSingletonScope(),t(PS).toService(AS))}));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};let AM=class extends tv{};AM=SM([Hr()],AM);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},MM=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 TM=class extends AM{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Yp}contains(t,e,i){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=Ed(t).line,r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=sv(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Hm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};TM=kM([Hr(),wM(0,jr(Ny)),MM("design:paramtypes",[Object])],TM);let CM=!1;const EM=new Tr(((t,e,i,s)=>{CM||(CM=!0,t(xS).to(TM).inSingletonScope(),t(PS).toService(xS))}));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},BM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RM=function(t,e){return function(i,s){e(i,s,t)}};let LM=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=Np}contains(t,e,i){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=Ed(t).area;let{x:r=n.x,y:a=n.y}=t.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,(t=>!!h||!!o&&(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;if(!l)return!1;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=sv(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};LM=PM([Hr(),RM(0,jr(Fy)),BM("design:paramtypes",[Object])],LM);let OM=!1;const IM=new Tr(((t,e,i,s)=>{OM||(OM=!0,t(yS).to(LM).inSingletonScope(),t(PS).toService(yS))}));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},FM=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)}};let zM=class extends AM{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Zp}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=Ed(t).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=sv(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Hm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};zM=DM([Hr(),jM(0,jr(Uy)),FM("design:paramtypes",[Object])],zM);let HM=!1;const NM=new Tr(((t,e,i,s)=>{HM||(HM=!0,t(kS).to(zM).inSingletonScope(),t(PS).toService(kS))}));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},GM=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 UM=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=Vp}contains(t,e,i){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=Ed(t).circle;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=sv(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};UM=VM([Hr(),WM(0,jr(jy)),GM("design:paramtypes",[Object])],UM);let YM=!1;const KM=new Tr(((t,e,i,s)=>{YM||(YM=!0,t(_S).to(UM).inSingletonScope(),t(PS).toService(_S))}));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},$M=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 ZM=class extends AM{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Jp}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=Ed(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Yg(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&&Hm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};ZM=XM([Hr(),qM(0,jr(Yy)),$M("design:paramtypes",[Object])],ZM);let JM=!1;const QM=new Tr(((t,e,i,s)=>{JM||(JM=!0,t(MS).to(ZM).inSingletonScope(),t(PS).toService(MS))}));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},ew=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iw=function(t,e){return function(i,s){e(i,s,t)}};let sw=class extends AM{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Kp}contains(t,e,i){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=Ed(t).path;s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer;return s.lineWidth=sv(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Hm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};sw=tw([Hr(),iw(0,jr(Vy)),ew("design:paramtypes",[Object])],sw);let nw=!1;const rw=new Tr(((t,e,i,s)=>{nw||(nw=!0,t(SS).to(sw).inSingletonScope(),t(PS).toService(SS))}));var aw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ow=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lw=function(t,e){return function(i,s){e(i,s,t)}};let hw=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=Xp}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=Ed(t).polygon;let{x:r=n.x,y:a=n.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer;return s.lineWidth=sv(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hw=aw([Hr(),lw(0,jr(Gy)),ow("design:paramtypes",[Object])],hw);let cw=!1;const dw=new Tr(((t,e,i,s)=>{cw||(cw=!0,t(wS).to(hw).inSingletonScope(),t(PS).toService(wS))}));var uw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gw=function(t,e){return function(i,s){e(i,s,t)}};let fw=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=Gp}contains(t,e,i){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}};fw=uw([Hr(),gw(0,jr(Xy)),pw("design:paramtypes",[Object])],fw);let mw=!1;const vw=new Tr(((t,e,i,s)=>{mw||(mw=!0,t(CS).to(fw).inSingletonScope(),t(PS).toService(CS))}));var yw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_w=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bw=function(t,e){return function(i,s){e(i,s,t)}};let xw=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=qp}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};xw=yw([Hr(),bw(0,jr(Ky)),_w("design:paramtypes",[Object])],xw);let Sw=!1;const Aw=new Tr(((t,e,i,s)=>{Sw||(Sw=!0,t(TS).to(xw).inSingletonScope(),t(PS).toService(TS))}));var kw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Mw=class{constructor(){this.type="image",this.numberType=Up}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Mw=kw([Hr()],Mw);let ww=!1;const Tw=new Tr(((t,e,i,s)=>{ww||(ww=!0,t(bS).to(Mw).inSingletonScope(),t(PS).toService(bS))})),Cw=Pb();function Ew(){Ew.__loaded||(Ew.__loaded=!0,$m.RegisterGraphicCreator("arc",Pm),Bc.load(ex),Bc.load(Cw?gM:SA))}Ew.__loaded=!1;const Pw=Ew;function Bw(){Bw.__loaded||(Bw.__loaded=!0,$m.RegisterGraphicCreator("area",Tm),Bc.load(ox),Bc.load(Cw?IM:CA))}Bw.__loaded=!1;const Rw=Bw;function Lw(){Lw.__loaded||(Lw.__loaded=!0,$m.RegisterGraphicCreator("circle",Gg),Bc.load(dx),Bc.load(Cw?KM:OA))}Lw.__loaded=!1;const Ow=Lw;function Iw(){Iw.__loaded||(Iw.__loaded=!0,$m.RegisterGraphicCreator("glyph",cm),Bc.load(xx),Bc.load(Cw?vw:HA))}Iw.__loaded=!1;const Dw=Iw;function Fw(){Fw.__loaded||(Fw.__loaded=!0,$m.RegisterGraphicCreator("group",rg))}Fw.__loaded=!1;const jw=Fw;function zw(){zw.__loaded||(zw.__loaded=!0,$m.RegisterGraphicCreator("image",fm),Bc.load(Ex),Bc.load(Cw?Tw:WA))}zw.__loaded=!1;const Hw=zw;function Nw(){Nw.__loaded||(Nw.__loaded=!0,$m.RegisterGraphicCreator("line",rm),Bc.load(rx),Bc.load(Cw?EM:qA))}Nw.__loaded=!1;const Vw=Nw;function Gw(){Gw.__loaded||(Gw.__loaded=!0,$m.RegisterGraphicCreator("path",km),Bc.load(fx),Bc.load(Cw?rw:lk))}Gw.__loaded=!1;const Ww=Gw;function Uw(){Uw.__loaded||(Uw.__loaded=!0,$m.RegisterGraphicCreator("polygon",Lm),Bc.load(vx),Bc.load(Cw?dw:ik))}Uw.__loaded=!1;const Yw=Uw;function Kw(){Kw.__loaded||(Kw.__loaded=!0,$m.RegisterGraphicCreator("rect",lm),Bc.load(sx),Bc.load(Cw?xM:fk))}Kw.__loaded=!1;const Xw=Kw;function $w(){$w.__loaded||($w.__loaded=!0,$m.RegisterGraphicCreator("richtext",xm),Bc.load(Tx),Bc.load(Cw?Aw:vk))}$w.__loaded=!1;const qw=$w;function Zw(){Zw.__loaded||(Zw.__loaded=!0,$m.RegisterGraphicCreator("shadowRoot",Im))}Zw.__loaded=!1;const Jw=Zw;function Qw(){Qw.__loaded||(Qw.__loaded=!0,$m.RegisterGraphicCreator("symbol",im),Bc.load(hx),Bc.load(Cw?NM:Ak))}Qw.__loaded=!1;const tT=Qw;function eT(){eT.__loaded||(eT.__loaded=!0,$m.RegisterGraphicCreator("text",qg),Bc.load(px),Bc.load(Cw?QM:Tk))}eT.__loaded=!1;const iT=eT;function sT(){jw(),Xw()}const nT=-.5*Math.PI,rT=1.5*Math.PI,aT="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 oT;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oT||(oT={}));const lT={[oT.selectedReverse]:{},[oT.selected]:{},[oT.hover]:{},[oT.hoverReverse]:{}},hT={container:"",width:30,height:30,style:{}},cT={debounce:bo,throttle:xo};sT();let dT=class t extends nS{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:Va({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=mo(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=mo(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===db.env?(db.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),db.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this._getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:cT[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:vo(o,s[0],s[1])}),"browser"===db.env?(db.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),db.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=vo(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",cT[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(vo(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:Nl(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]=Nl(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=vo(t,0,1),{width:n,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?vo([a+i*n,a+s*n],a,n-l):vo([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function uT(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&uT(t,e)}))}dT.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};const pT=t=>!ma(t)&&!1!==t.visible;function gT(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function fT(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 vT=["#ffffff","#000000"];function yT(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new pl(t).toHex(),o=new pl(e).toHex();return _T(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(...vT);for(const n of a)if(t!==n&&_T(n,e,i,s,r))return n}(a,o,i,s,n,r)}function _T(t,e,i,s,n){if("lightness"===n){const i=pl.getColorBrightness(new pl(e));return pl.getColorBrightness(new pl(t))<.5?i>=.5:i<.5}return s?bT(t,e)>s:"largeText"===i?bT(t,e)>3:bT(t,e)>4.5}function bT(t,e){const i=xT(t),s=xT(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function xT(t){const e=fl(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 ST(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 AT(t,e){return[t[0]*e,t[1]*e]}function kT(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const MT=(t,e,i,s)=>new zl(Object.assign({defaultFontParams:Object.assign({fontFamily:aT,fontSize:14},s),getTextBounds:i?void 0:Jm,specialCharSet:"-/: .,@%'\"~"+zl.ALPHABET_CHAR_SET+zl.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function wT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=Jm({text:t,fontFamily:e.fontFamily||i.fontFamily||aT,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 TT(t){return"rich"===CT(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function CT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return ya(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 ET(t){var e,i;return t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.maxWidth=t.maxLineWidth,t.textConfig=t.text.text||t.text,t}function PT(t){const e=CT(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?$m.richtext(ET(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),$m.text(t))}function BT(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 RT=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function LT(){jw(),Xw(),tT(),qw(),iT()}var OT=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&&(_=h,M.setAttribute("maxLineWidth",h-m[1]-m[2])));let E=0,P=0,B=0;"left"===T||"start"===T?B=1:"right"===T||"end"===T?B=-1:"center"===T&&(B=0),B?B<0?(E-=_,y&&y.setAttribute("x",(y.attribute.x||0)-p),v.setAttribute("x",-m[1]-S)):B>0&&v.setAttribute("x",m[3]):(E-=_/2,y&&y.setAttribute("x",(y.attribute.x||0)-p/2),v.setAttribute("x",-S/2));const R="right"===f||"end"===f,L="left"===f||"start"===f;if((f?"center"===f:g)&&B){const t=_-m[1]-m[3],e=p+S,i=1===B?(t-e)/2+S+p/2:m[0]+S-(_/2+e/2-S)+p/2;if(M.setAttributes({x:i,textAlign:"center"}),y){const t=i-p/2-S+w/2;y.setAttributes({x:t})}}if(L&&1!==B){const t=_-m[1]-m[3],e=0===B?-t/2+S/2:-_+m[3]+m[1]+S,i=e+S;if(M.setAttributes({x:i,textAlign:"left"}),y){const t=e+w/2;y.setAttributes({x:t})}}if(R&&-1!==B){const t=_-m[1]-m[3],e=0===B?t/2+S/2:t;if(M.setAttributes({x:e,textAlign:"right"}),y){const t=e-p-S+w/2;y.setAttributes({x:t})}}"middle"===C?(P-=b/2,y&&y.setAttribute("y",0)):"bottom"===C?(P-=b,y&&y.setAttribute("y",-A/2),v.setAttribute("y",-m[2])):"top"===C&&(v.setAttribute("y",m[0]),y&&y.setAttribute("y",A/2));const{visible:O}=a,I=OT(a,["visible"]);if(d&&ga(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},I),{visible:O&&!!s,x:E,y:P,width:_,height:b}),"rect");Oa(null==u?void 0:u.panel)||(t.states=u.panel),this._bgRect=t}}this._textShape=M}}IT.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const DT={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}},FT={poptip:Va({},DT)};var jT=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);ng?z=g:z_l&&([yl,_l]=[_l,yl]),bl>xl&&([bl,xl]=[xl,bl]),Sl>Al&&([Sl,Al]=[Al,Sl]),kl>Ml&&([kl,Ml]=[Ml,kl])),yl>Sl&&_lkl&&xlyl&&Al<_l&&kl>bl&&Ml$&&($=n,X=t)}}}var q,Z,J}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Co/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Co/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Co/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Co/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Co/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Co/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Co,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Co,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Co,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}HT.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var NT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let VT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};Va(s,HT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new HT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};Va(e,FT.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};VT=NT([Hr()],VT);var GT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WT=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=wr.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};WT=GT([Hr()],WT);let UT=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=wr.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)},this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute||e.attribute.disableAutoClipedPoptip)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip),e.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip),e.removeEventListener("pointerleave",this.pointerlave)}};UT=GT([Hr()],UT);const YT=new Tr(((t,e,i,s)=>{i(VT)||(t(VT).toSelf().inSingletonScope(),t(Hg).toService(VT)),i(WT)||(t(WT).toSelf(),t(S_).toService(WT)),i(UT)||(t(UT).toSelf(),t(S_).toService(UT))}));class KT extends nS{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}jw(),Vw();class XT extends KT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},XT.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})}}XT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},jw(),Xw();class $T extends KT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},$T.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})}}$T.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},jw(),Pw();class qT extends KT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},qT.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=Yo.distancePP(t,e);this.setAttribute("radius",i)}}qT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},jw(),Pw();class ZT extends KT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},ZT.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=nT,endAngle:s=rT}=this.attribute,n=s-i,r=Zo(tl(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}ZT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},jw(),Ww();class JT extends KT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},JT.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=Qo(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=Yo.distancePP(t,e);this.setAttribute("radius",i)}}JT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const QT=new Uint32Array(33),tC=new Uint32Array(33);tC[0]=0,QT[0]=~tC[0];for(let t=1;t<=32;++t)tC[t]=tC[t-1]<<1|1,QT[t]=~tC[t];function eC(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&QT[31&l]&tC[1+(31&h)])return!0}else{if(i[c]&QT[31&l])return!0;if(i[d]&tC[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,QT[31&n]&tC[1+(31&r)]);else for(s(a,QT[31&n]),s(o,tC[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,tC[31&i]|QT[1+(31&s)]);else for(n(r,tC[31&i]),n(a,QT[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function iC(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:s,y1:n,y2:r}=e,a=mo(i,0,t.width),o=mo(s,0,t.width),l=mo(n,0,t.height),h=mo(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}return{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function sC(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=iC(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function nC(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>va(t)));for(let a=0;aa(n.AABBBounds,r,t,s.offset)));return nC(t,e,n,o,h,c)}return!1}var d;if("moveY"===i.type){const s=(i.offset?fa(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return nC(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?fa(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return nC(t,e,n,s,h,c)}return!1}const aC=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],oC=["top","inside-top","inside"];function lC(t,e,i){const{x1:s,x2:n,y1:r,y2:a}=t.AABBBounds,o=Math.min(s,n),l=Math.max(s,n),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const hC={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function cC(t,e){var i,s;return null!==(s=null===(i=hC[e])||void 0===i?void 0:i.call(hC,t))&&void 0!==s?s:{from:{},to:{}}}const dC=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return $a(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function uC(t,e,i,s){t.attribute.text!==e.attribute.text&&Ta(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new _u({text:t.attribute.text},{text:e.attribute.text},i,s))}const pC={mode:"same-time",duration:300,easing:"linear"};function gC(t,e,i,s){const n=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:s});return{x:t+n.x,y:e+n.y}}function fC(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function mC(t){return 3===t||4===t}function vC(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 yC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,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)}},_C=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 bC(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}function xC(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)}}jw(),iT(),qw(),Vw();class SC extends nS{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},SC.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||Oa(e.states)||(e.addState(oT.hover,!0),uT(this,(t=>{t===e||Oa(t.states)||t.addState(oT.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(uT(this,(t=>{Oa(t.states)||(t.removeState(oT.hoverReverse),t.removeState(oT.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void uT(this,(t=>{Oa(t.states)||(t.removeState(oT.selectedReverse),t.removeState(oT.selected))}));Oa(e.states)||(e.addState(oT.selected,!0),uT(this,(t=>{t===e||Oa(t.states)||t.addState(oT.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)===sh.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===sh.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}}}labeling(t,e,i,s){}_createLabelLine(t,e){const i=function(t,e){if(!t||!e)return;if(El(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[xC(g,f,c,d,a,o),xC(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=$m.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!Oa(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}render(){if(this._prepare(),ma(this._idToGraphic)||this._isCollectionBase&&ma(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;fa(i)&&(r=i(r));let a=this._initText(r);a=fa(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),fa(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!Oa(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!Oa(e)&&(t.states=e)}_createLabelText(t){var e,i;return PT(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e,i,s,n;const r=[];let a;if(a=fa(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),a.forEach((t=>{"willRelease"!==t.releaseStatus&&r.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=r,this._isCollectionBase="line-data"===this.attribute.type,!r||0===r.length)return;const{data:o}=this.attribute;if(o&&0!==o.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;s"bound"===t.type));h&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&m.setRange(iC(f,t.AABBBounds,!0))}))),p.length>0&&p.forEach((t=>{Sa(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&&m.setRange(iC(f,t.AABBBounds,!0))})):t.AABBBounds&&m.setRange(iC(f,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=cC(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=e.text,{duration:r,easing:a}=this._animationConfig.update;(function(t,e,i){if(!Aa(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&uC(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=dC(t,e,o,i.options);Oa(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&uC(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(cC(t.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd((()=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)}))})),this._graphicToText=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,f;const{detail:m}=o;if(!m)return{};const v=null===(p=m.animationState)||void 0===p?void 0:p.step;if(m.type!==sh.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(m.type===sh.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const y=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":m.animationState.end&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&m.animationState.end&&(e.forEach((t=>{t.animate({onStart:y}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,ih.LOCAL,null===(f=this.stage)||void 0===f?void 0:f.pickerService)||(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else m.animationState.isFirstFrameOfStep&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r;const a=ya(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:o,contrastRatiosThreshold:l,alternativeColors:h,mode:c}=a,d=null!==(e=a.fillStrategy)&&void 0!==e?e:"invertBase",u=null!==(i=a.strokeStrategy)&&void 0!==i?i:"base",p=null!==(s=a.brightColor)&&void 0!==s?s:"#ffffff",g=null!==(n=a.darkColor)&&void 0!==n?n:"#000000",f=null!==(r=a.outsideEnable)&&void 0!==r&&r;if("null"!==d||"null"!==u)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}AC.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class kC extends SC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},kC.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=Hl(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}}}kC.tag="rect-label",kC.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let MC=class t extends SC{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:Va({},t.defaultAttributes,e)),this.name="line-label"}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type)return super.getGraphicBounds(t,e);const s=t.attribute.points||[e],n="start"===i?0:s.length-1;return s[n]?{x1:s[n].x,x2:s[n].x,y1:s[n].y,y2:s[n].y}:void 0}labeling(t,e){return bC(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};MC.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class wC{constructor(t,e,i,s,n,r,a,o,l){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=s,this.radian=n,this.middleAngle=r,this.innerRadius=a,this.outerRadius=o,this.circleCenter=l,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class TC extends SC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},TC.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(t){if(!t||!t.length)return;const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),s=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);for(let t=0;t{var e;return(null===(e=t.refDatum)||void 0===e?void 0:e.id)===i.id}));if(s){const i={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:s.pointA&&s.pointB&&s.pointC?[s.pointA,s.pointB,s.pointC]:void 0,line:s.labelLine};e[t].setAttributes(i)}}return e}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!ma(s[i])&&!ma(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=fC(l.endAngle-d/2),p=gC(h.x,h.y,l.outerRadius,o),g=gC(h.x,h.y,a+e.line.line1MinLength,o),f=new wC(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);f.pointA=gC(h.x,h.y,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),f.middleAngle),f.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=f.quadrant)||2===c?this._arcRight.set(f.refDatum,f):mC(f.quadrant)&&this._arcLeft.set(f.refDatum,f)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var 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,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:u+l-y,t.labelPosition=gC(t.circleCenter.x,t.circleCenter.y,v,t.middleAngle),t.labelLimit=f,po(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.line.line2MinLength,h=e.layout,c=e.spaceWidth;if(t.forEach((t=>{const e=mC(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+l+c),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===h.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=mC(s.quadrant)?{x:t.x+n.width/2+l+c,y:t.y}:{x:t.x-n.width/2-l-c,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===h.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const d=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(go(t.pointB.x,l+c)||po(t.pointB.x,d-l-c))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign({},e.line)})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=2*n.x;n.y;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=e.line.line2MinLength,c=null===(s=e.layout)||void 0===s?void 0:s.align,d=e.spaceWidth,{labelPosition:u,quadrant:p,pointB:g}=t;Ta(g.x*g.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const f=this.computeRadius(o,e.width,e.height),m=mC(p)?-1:1;let v=0,y=(m>0?r-g.x:g.x)-h-d;"labelLine"===c&&(v=(f+l+h)*m+n.x,y=(m>0?r-v:v)-d);const _=this._getFormatLabelText(t.refDatum,y);t.labelText=_;let b=Math.min(y,t.labelSize.width);switch(c){case"labelLine":break;case"edge":v=m>0?r-b-d:b+d;break;default:v=g.x+m*h}b=Math.max(this._ellipsisWidth,b),t.labelLimit=b,t.pointC={x:v,y:u.y};const x=.5*(t.labelLimit0?r+t:t)-m*x}else{const t=0;u.x=v+t+m*(d+x)}}_computeAlign(t,e){var i,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?ma(h)||"auto"===h?"edge"===c?mC(t.quadrant)?"left":"right":mC(t.quadrant)?"right":"left":h:ma(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;Ta(c)?t.pointB={x:s.x+c*(mC(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(uo(l/2,u))g=0,f=1,m=-p;else if(uo(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?uo(v[0].y,v[1].y)?po(t.middleAngle,-Math.PI)&&go(t.middleAngle,0)||po(t.middleAngle,Math.PI)&&go(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";var s;if("area"!==t.type)return super.getGraphicBounds(t,e);const n=(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)||[e],r="start"===i?0:n.length-1;return{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}}labeling(t,e){return bC(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}CC.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class EC extends SC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},EC.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return yC(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}EC.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const PC={rect:kC,symbol:AC,arc:TC,line:MC,area:CC,"line-data":EC};class BC extends nS{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},BC.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||0===e.length)return;const{width:s=0,height:n=0,padding:r}=i||{};if(!s||!n||!Ta(n*s))return;this._componentMap||(this._componentMap=new Map);const a=eC(s,n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let i=0;i{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function RC(){jw(),Vw(),Yw(),tT()}function LC(){jw(),Vw(),Pw(),tT()}BC.defaultAttributes={pickable:!1},RC();class OC extends nS{getStartAngle(){return el(this._startAngle)}getEndAngle(){return el(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},OC.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(Ta(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(eo(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=$m.line(Object.assign(Object.assign({points:t},Aa(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),Oa(null==s?void 0:s.line)||(a.states=Aa(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=$m.line;$a(i)[0].cornerRadius&&(t=$m.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},$a(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),Oa(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+(Ta(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(Ta(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(Ta(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(Ta(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=$m.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`),Oa(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?Oa(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):Oa(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?Ta(i)?t[i]:eo(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}}OC.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}}},LC();class IC extends OC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},OC.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=$m.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"),Oa(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var DC,FC;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background"}(DC||(DC={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(FC||(FC={}));const jC={[FC.selectedReverse]:{},[FC.selected]:{},[FC.hover]:{},[FC.hoverReverse]:{}},zC={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},HC=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=Po;else if(t>0)for(;t>Po;)t-=Po;return t};function NC(t,e,i){return!go(t,e,0,1e-6)&&!po(t,i,0,1e-6)}function VC(t,e,i,s){const n=Jm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=HC(Math.atan2(e[1],e[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,c=Math.PI/2,d=t.x;let u=0;u=NC(o,-l,-h)?((o+l)/c-.5)*r:NC(o,h,l)?(.5-(o-h)/c)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=d-u,g=t.y;let f=0;return f=NC(o,-l,-h)?.5*-a:NC(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-HC(o-l)/c)*a,{x:p,y:g-f}}function GC(t){const e={};return uT(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function WC(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function UC(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return AT(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const YC=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!Oa(s.states)?(s.addState(oT.hover,!0),uT(e,(t=>{t!==s&&t.name&&!Oa(t.states)&&t.addState(oT.hoverReverse,!0)})),s):i},KC=(t,e,i)=>i?(uT(e,(t=>{t.name&&!Oa(t.states)&&(t.removeState(oT.hoverReverse),t.removeState(oT.hover))})),null):i,XC=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(oT.selected)?(uT(e,(t=>{t.name&&!Oa(t.states)&&(t.removeState(oT.selectedReverse),t.removeState(oT.selected))})),null):s.name&&!Oa(s.states)?(s.addState(oT.selected,!0),uT(e,(t=>{t!==s&&t.name&&!Oa(t.states)&&t.addState(oT.selectedReverse,!0)})),s):i};class $C extends nS{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=YC(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=KC(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=XC(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=ja(this.attribute);Va(this.attribute,t);const i=$m.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&GC(this._innerView),this.removeAllChild(!0),this._innerView=$m.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=$m.group({x:0,y:0,zIndex:1});if(a.name=DC.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=$m.group({x:0,y:0,pickable:!1});t.name=DC.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle";n.forEach((t=>{var e;const i=t.attribute,s=null!==(e=i.angle)&&void 0!==e?e:0,n=t.AABBBounds;let r=n.width(),c=n.height();s&&(r=Math.abs(r*Math.cos(s)),c=Math.abs(c*Math.sin(s))),a=Math.max(a,r),o=Math.max(o,c),l=i.textAlign,h=i.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=$m.group({x:0,y:0,pickable:!1});i.name=DC.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=$m.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=DC.tick,r.id=this._getNodeId(t.id),Oa(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=lT;else{const t=this.data[s],e=Va({},lT,this.attribute.tick.state);Object.keys(e).forEach((i=>{fa(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=$m.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=DC.subTick,r.id=this._getNodeId(`${n}`),Oa(s.state))r.states=lT;else{const i=Va({},lT,s.state);Object.keys(i).forEach((s=>{fa(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&&fa(s)&&(e=s(e,i));const n=this._transformItems(e),r=$m.group({x:0,y:0,pickable:!1});return r.name=`${DC.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=PT(this._getLabelAttribute(t,e,n,i));if(a.name=DC.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),Oa(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=lT;else{const s=Va({},lT,this.attribute.label.state);Object.keys(s).forEach((r=>{fa(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new IT(Object.assign({},e));i.name=DC.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return WC(t,this.getVerticalVector(e,i,t))}getTextAlign(t){let e="center";return uo(t[0],0)?uo(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&fa(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;Ro(s[0])>Ro(s[1])?o=Co/2*(l.x>e.x?1:-1):h=Co/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===p[1]?d+=(this.axisLabelLayerSize[s-1].height+Ia(this.attribute,"label.space",4))*s:d+=(this.axisLabelLayerSize[s-1].width+Ia(this.attribute,"label.space",4))*s);const g=this.getVerticalCoord(t.point,d,o),f=this.getVerticalVector(d||1,o,g),m=l?l(`${t.label}`,t,e,i,s):t.label;let{style:v}=this.attribute.label;v=fa(v)?Va({},zC.label.style,v(t,e,i,s)):v;return v=Va(this.getLabelAlign(f,o,v.angle),v),fa(v.text)&&(v.text=v.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(g,f,m,v)),{text:null!=c?c:m,_originText:t.label,lineHeight:null==v?void 0:v.fontSize,type:h}),v)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}function qC(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),s=i.x-e.centerX,n=i.y-e.centerY;var r,a,o,l,h;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}function ZC(t,e){return El(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=Ll(t,i),r=Ll(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=Rl(t),l=Rl(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:qo(t.angle);let f=i?t.angle+Eo:qo(90-t.angle);const m=i?e.angle:qo(e.angle);let v=i?e.angle+Eo:qo(90-e.angle);f>Bo&&(f-=Bo),v>Bo&&(v-=Bo);const y=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Pl(n,i)+Pl(n,s))/2>Pl(n,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,m,c,d)&&y((e.y2-e.y1)/2,v,c,d)}(t.rotatedBounds,e.rotatedBounds,!0))}const JC={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&&QC(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function QC(t,e,i){const s=t.AABBBounds,n=e.AABBBounds;return i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2)&&(!t.rotatedBounds||!e.rotatedBounds||i>Math.max(e.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.x1-e.rotatedBounds.x2,e.rotatedBounds.y1-t.rotatedBounds.y2,t.rotatedBounds.y1-e.rotatedBounds.y2))}function tE(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function iE(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},rE(t,e.attribute.angle)),{angle:nE(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({},aE(t,e.attribute.angle)),{angle:nE(e.attribute.angle)}))}))}(t,e),qC(e)}function nE(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function rE(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=nE(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 aE(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],s=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=nE(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}class oE{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){const[e,i]=t;let s=e*e+i*i;return s>0&&(s=1/Math.sqrt(s)),[t[0]*s,t[1]*s]}(this.getRelativeVector());return AT([s[1],-1*s[0]],t*(e?1:-1)*i)}}function lE(){jw(),Vw(),qw(),iT()}var hE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,s="start"===i||"left"===i,n="center"===i,r=v[1]>0;y=1===f?r?s?y:n?y/2:t:s?t:n?y/2:y:r?s?t:n?y/2:y:s?y:n?y/2:t}}let _=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(_=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(_=Math.max(_,this.attribute.subTick.length||2));const b=_+y+r,x=this.getVerticalCoord(m,b,!1),S=this.getVerticalVector(b,!1,{x:0,y:0});let A,k,{angle:M}=u;if(A="start"===n?"start":"end"===n?"end":"center",ma(M)&&o){M=kT(v,[1,0],!0);const{verticalFactor:t=1}=this.attribute;k=1==-1*t?"bottom":"top"}else A=this.getTextAlign(S),k=this.getTextBaseline(S,!1);let w=d;if(ma(w)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(Ta(s))if("bottom"===i||"top"===i)if(M!==Math.PI/2){const t=Math.abs(Math.cos(null!=M?M:0));w=t<1e-6?1/0:this.attribute.end.x/t}else w=s-b;else if(M&&0!==M){const t=Math.abs(Math.sin(M));w=t<1e-6?1/0:this.attribute.end.y/t}else w=s-b}const T=Object.assign(Object.assign(Object.assign({},x),u),{maxWidth:w,textStyle:Object.assign({textAlign:A,textBaseline:k},a),state:{text:Va({},jC,c.text),shape:Va({},jC,c.shape),panel:Va({},jC,c.background)}});return T.angle=M,l&&l.visible&&(T.shape=Object.assign({visible:!0},l.style),l.space&&(T.space=l.space)),h&&h.visible&&(T.panel=Object.assign({visible:!0},h.style)),T}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return uo(t[1],0)?i=!uo(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 rE(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return aE(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=qa(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(Oa(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:u,limitEllipsis:p,autoHide:g,autoHideMethod:f,autoHideSeparation:m,lastVisible:v}=a;if(fa(h))h(t,e,s,this);else{if(c&&function(t,e){if(Oa(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=qo(e)})),sE(i,t),!iE(t))break}}(t,{labelRotateAngle:d,orient:o}),u&&Ta(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);!function(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(Oa(t)||!Ta(i))return;const o=Math.sin(Math.PI/10);t.forEach((t=>{var e;const l=t.attribute.angle,h=!ma(l),c=h?Math.cos(l):1,d=h?Math.sin(l):0,u=!h||Math.abs(d)<=o,p=h&&Math.abs(c)<=o,g="top"===r||"bottom"===r;if(g){if(p&&Math.floor(t.AABBBounds.height())<=i)return;if(u&&Math.floor(t.AABBBounds.width())<=s)return}const f=t.attribute.direction;if(!g){if("vertical"===f&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==f){if(u&&Math.floor(t.AABBBounds.width())<=i)return;if(p&&Math.floor(t.AABBBounds.height())<=s)return}}let m=null;if(u||p)m=g?u?s:i:"vertical"===f||p?s:i;else if(g){const{x1:e,x2:s}=t.AABBBounds,n=d/c;m=n>0&&e<=a&&i/n+e>a?(a-e)/Math.abs(c):n<0&&s>=0&&i/n+s<0?s/Math.abs(c):Math.abs(i/d)}else m=Math.abs(i/c);Ta(t.attribute.maxLineWidth)&&(m=Ta(m)?Math.min(t.attribute.maxLineWidth,m):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:m,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}(t,{limitLength:l,verticalLimitLength:e?i/t.length:g||c?1/0:i/t.length,ellipsis:p,orient:o,axisLength:i})}g&&function(t,e){if(Oa(t))return;const i=t.filter(eE);if(Oa(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),qC(s);const{method:n="parity",separation:r=0}=e,a=fa(n)?n:JC[n]||JC.parity;if(s.length>=3&&tE(s,r)){do{s=a(s,r)}while(s.length>=3&&tE(s,r));if(s.length<3||e.lastVisible){const t=qa(i);if(!t.attribute.opacity){const e=s.length;if(e>1){t.setAttribute("opacity",1);for(let i=e-1;i>=0&&QC(s[i],t,r);i--)s[i].setAttribute("opacity",0)}}}}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:f,separation:m,lastVisible:v})}}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(Ta(c)&&(!Ta(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=$m.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=DC.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(va(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){if("right"===s||"left"===s){if("left"===n){const n="right"===s?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"left"})}))}else if("right"===n){const n="right"===s?1:0;t.forEach((t=>{t.setAttributes({x:e+i*n,textAlign:"right"})}))}else if("center"===n){const n="right"===s?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*n,textAlign:"center"})}))}}else if("bottom"===s||"top"===s)if("top"===n){const n="bottom"===s?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"top"})}))}else if("bottom"===n){const n="bottom"===s?1:0;t.forEach((t=>{t.setAttributes({y:e+i*n,textBaseline:"bottom"})}))}else if("middle"===n){const n="bottom"===s?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*n,textBaseline:"middle"})}))}}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const 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=wT(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=Nl(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}}cE.defaultAttributes=zC,Xa(cE,oE);class dE{isInValidValue(t){const{startAngle:e=nT,endAngle:i=rT}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=nT,endAngle:i=rT,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return Qo(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return UC(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}var uE,pE=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(l=r,h=0);const c=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),a.style),d=$m.circle(c);d.name=DC.line,d.id=this._getNodeId("line"),Oa(a.state)||(d.states=Va({},jC,a.state)),t.add(d)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,u=pE(a,["space","textStyle","shape","background","state"]);let p=s,g=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(g=Ia(this.attribute.label,"style.fontSize",12)+Ia(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=n+f+g+o;let v="middle",{position:y}=this.attribute.title;ma(y)&&(y=0===r?"end":"middle"),"start"===y?(v="bottom",p={x:s.x,y:s.y-m}):"end"===y&&(v="top",p={x:s.x,y:s.y+m});const _=Object.assign(Object.assign(Object.assign({},p),u),{textStyle:Object.assign({textBaseline:v,textAlign:"center"},l),state:{text:Va({},jC,d.text),shape:Va({},jC,d.shape),panel:Va({},jC,d.background)}}),{angle:b}=u;return _.angle=b,h&&h.visible&&(_.shape=Object.assign({visible:!0},h.style),h.space&&(_.space=h.space)),c&&c.visible&&(_.panel=Object.assign({visible:!0},c.style)),_}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,s,n){}handleLabelsOverlap(t,e,i,s,n){}afterLabelsOverlap(t,e,i,s,n){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return VC(t,e,i,s)}}gE.defaultAttributes=zC,Xa(gE,dE);class fE extends qd{constructor(){super(...arguments),this.mode=rh.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},uT(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!Ya(t.attribute,l.attribute)){const e=ja(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=Ta(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=ko.lastIndex=Mo.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=ko.exec(t))&&(s=Mo.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:So(i,s)})),r=Mo.lastIndex;return r(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function bE(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function xE(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]2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(ma(s)&&(s=t.length);i>>1;so(t[n],e)>0?s=n:i=n+1}return i}(t,e,1,s)-1;return r[i](n[i](e))}}!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(uE||(uE={})),Object.values(uE).forEach((t=>{}));let SE=class{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:va(this._rangeFactorStart)&&va(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=function(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}(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):va(this._rangeFactorStart)&&va(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return ma(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!ma(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 ma(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!ma(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=mo(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=ma(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const u=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*u))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}};const{interpolateRgb:AE}=ml;function kE(t,e){const i=typeof e;let s;if(ma(e)||"boolean"===i)return()=>e;if("number"===i)return So(t,e);if("string"===i){if(s=pl.parseColorString(e)){const e=AE(pl.parseColorString(t),s);return t=>e(t).formatRgb()}return So(Number(t),Number(e))}return e instanceof gl?AE(t,e):e instanceof pl?AE(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):So(Number(t),Number(e))}let ME=class extends SE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yE,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yE;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=yE,this._piecewise=bE,this._interpolate=kE}calculateVisibleDomain(t){var e;return va(this._rangeFactorStart)&&va(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),So)),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,no);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=Ao,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=yo(i[0],i[r-1])),this._piecewise=r>2?xE:bE,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:yE),this.rescale(i)):this._clamp!==yE}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return ma(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return ma(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}};const wE=Math.sqrt(50),TE=Math.sqrt(10),CE=Math.sqrt(2),EE=[1,2,5,10],PE=(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=OE(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)),io(0,e).map((t=>n+t*s))):t>0?RE(0,-(e-1)/s,s):RE((e-1)/s,0,s)},BE=fo(((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 PE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return PE(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=RE(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=RE(t,e,l);return n&&r.reverse(),r})),OE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=EE[0];return i>=wE?s=EE[3]:i>=TE?s=EE[2]:i>=CE&&(s=EE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function IE(t,e,i){const s=(e-t)/Math.max(0,i);return OE(s)}function DE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=IE(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}let jE=class t extends ME{constructor(){super(...arguments),this.type=uE.Linear}clone(){return(new t).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return BE(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(va(this._rangeFactorStart)&&va(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=LE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return DE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=function(t,e){const i=wa(e.forceMin),s=wa(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:wa(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:wa(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),wa(r[0])&&wa(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=wa(r[0])||wa(r[1])?wa(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=FE(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=FE(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=FE(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}};const zE=t=>t.map(((t,e)=>({index:e,value:t}))),HE=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new $o(t).expand(i/2),n=new $o(e).expand(i/2);return s.intersects(n)};function NE(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function VE(t,e){for(let i,s=1,n=t.length,r=t[0];sit?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=qo(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=MT(n),f=t.range(),m=e.map(((i,s)=>{var r,l;const m=o?o(i):`${i}`,{width:v,height:y}=g.quickMeasure(m),_=Math.max(v,12),b=Math.max(y,12),x=t.scale(i),S=u*x,A=p*x;let k,M,w=S,T=A;a&&c&&0===s?w=GE(S,_,f[0],f[f.length-1]):a&&c&&s===e.length-1?w=GE(S,_,f[f.length-1],f[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?w-=_:"center"===k&&(w-=_/2),a&&d&&0===s?T=GE(A,b,f[0],f[f.length-1]):a&&d&&s===e.length-1?T=GE(A,b,f[f.length-1],f[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?T-=b:"middle"===M&&(T-=b/2);const C=(new $o).set(w,T,w+_,T+b);return h&&C.rotate(h,S,A),C}));return m},UE=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=MT(n),u=e.map((e=>{var i,s;const r=o?o(e):`${e}`,{width:u,height:p}=d.quickMeasure(r),g=Math.max(u,12),f=Math.max(p,12),m=t.scale(e);let v=0,y=0;const _=null!==(i=n.textAlign)&&void 0!==i?i:"center",b=null!==(s=n.textBaseline)&&void 0!==s?s:"middle",{x:x,y:S}=function(t,e,i,s,n,r,a){const o=Qo({x:0,y:0},i,t),l=WC(o,UC(s,o,e,n));return VC(l,UC(s||1,l,e,n),r,a)}(m,{x:0,y:0},h,a,l,r,n);return v=x+("right"===_?-g:"center"===_?-g/2:0),y=S+("bottom"===b?-f:"middle"===b?-f/2:0),(new $o).set(v,y,v+g,y+f).rotate(c,v+g/2,y+f/2)}));return u},YE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&NE(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},KE=(t,e,i,s)=>WE(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),XE=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},$E=(t,e)=>t[1]{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+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 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&&!XE(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?$E(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&HE(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},JE=(t,e)=>{if(vE(t.type))return((t,e)=>{if(!vE(t.type))return zE(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return zE([t.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=e;let h;if(va(a))h=t.stepTicks(a);else if(va(r))h=t.forceTicks(r);else if("d3"===e.tickMode){const e=fa(n)?n({axisLength:s,labelStyle:l}):n;h=t.d3Ticks(null!=e?e:5,{noDecimals:o})}else{const e=fa(n)?n({axisLength:s,labelStyle:l}):n;h=t.ticks(null!=e?e:5,{noDecimals:o})}if(e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=WE(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&VE(n,i);)n=YE.parity(n);const r=n.map((t=>t.value));r.length<3&&s&&(r.length>1&&r.pop(),qa(r)!==qa(h)&&r.push(qa(h))),h=r}return zE(h)})(t,e);if(function(t){switch(t){case uE.Ordinal:case uE.Point:case uE.Band:return!0;default:return!1}}(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),d=t.range(),u=t.calculateWholeRangeSize();if(u<2)return e.labelLastVisible?zE([s[s.length-1]]):zE([s[0]]);let p;if(va(a))p=t.stepTicks(a);else if(va(r))p=t.forceTicks(r);else if(va(n)){const e=fa(n)?n({axisLength:u,labelStyle:h}):n;p=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=Ja(d),a=Za(d);if(s.length<=u/n){const i=(a-r)/s.length,n=KE(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=qE(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);p=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(p=p.slice(0,p.length-h.delCount)),p.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=KE(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;p=t.stepTicks(h),!e.labelLastVisible||p.length&&p[p.length-1]===s[s.length-1]||(p.length&&Math.abs(t.scale(p[p.length-1])-t.scale(s[s.length-1])){const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return zE(t.domain());let c;if(va(n))c=t.stepTicks(n);else if(va(s))c=t.forceTicks(s);else if(va(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=fa(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=UE(t,i,e),r=Ja(s),l=Za(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=ZE(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 zE(c)})(t,e)}return zE(t.domain())};function QE(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 tP(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Yo.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 eP(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=QE(t,!!n),o=QE(r,!!n);const h=Yo.distancePP(s,l),c=Yo.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=tP(e,t,!1,!!n),o=tP(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=QE(t,!!n),o=QE(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class iP extends nS{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&GC(this._innerView),this.removeAllChild(!0),this._innerView=$m.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 WC(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=Va({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${DC.grid}-sub`:`${DC.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=QE(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=tP(t,o,!1,!!a)}const d=$m.path(Object.assign({path:c,z:l},fa(r)?Va({},this.skipDefault?null:iP.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,u=Math.sqrt(c*c+d*d),p=l/u;o.push({x:n[0].x+c*p,y:n[0].y+d*p});const g=QE(o,!!a),f=Ro(o[0].x-o[1].x),m=Ro(o[0].y-o[1].y),v=$m.path(Object.assign({path:g,z:0,alpha:f>m?(n[1].x-n[0].x>0?-1:1)*Co/2:0,beta:fm?[o[0].x,0]:[0,o[0].y]},fa(r)?Va({},this.skipDefault?null:iP.defaultAttributes.style,r(t,i)):r));v.name=`${h}-line`,v.id=this._getNodeId(`${h}-path-${s}`),e.add(v)})),n.length>1&&o){const t=Aa(o)?o:[o,"transparent"],s=e=>t[e%t.length];for(let t=0;t=2&&(n=this.data[1].value-this.data[0].value);let r=[];if(t){s=Va({},this.attribute,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subGrid||{};if(this.data.length>=2){const s=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-n/2;if(this.isInValidValue(i))return;e=i}s.push({value:e})}));for(let i=0;i{let{point:r}=s;if(!i){const t=s.value-n/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:s.label,datum:s,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},s),{items:r})}}Xa(sP,oE);var nP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2&&(p=this.data[1].value-this.data[0].value),t){e=Va({},c,h);const t=[],{count:s=4}=h||{},n=this.data.length;if(n>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!d){const e=t.value-p/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}Xa(rP,dE);const aP="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",oP={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:aP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:aP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},lP={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var hP;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(hP||(hP={}));var cP=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=hP.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=hP.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=hP.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=hP.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=hP.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===db.env&&(db.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),db.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===hP.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===hP.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=hP.endHandler):h+=l:this._activeTag===hP.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===hP.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),"browser"===db.env&&(db.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),db.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:mo(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===hP.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:mo(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===hP.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:s}=this.attribute,{formatMethod:n}=i,r=cP(i,["formatMethod"]),{formatMethod:a}=s,o=cP(s,["formatMethod"]),{start:l,end:h}=this.state;this._startValue=this._statePointToData(l),this._endValue=this._statePointToData(h);const{position:c,width:d,height:u}=this.getLayoutAttrFromConfig(),p=n?n(this._startValue):this._startValue,g=a?a(this._endValue):this._endValue,f={x1:c.x,y1:c.y,x2:c.x+d,y2:c.y+u};let m,v,y,_;this._isHorizontal?(m={x:c.x+l*d,y:c.y+u/2},v={x:c.x+h*d,y:c.y+u/2},y={textAlign:this.isTextOverflow(f,t,"start")?"left":"right",textBaseline:"middle"},_={textAlign:this.isTextOverflow(f,e,"end")?"right":"left",textBaseline:"middle"}):(m={x:c.x+d/2,y:c.y+l*u},v={x:c.x+d/2,y:c.y+h*u},y={textAlign:"center",textBaseline:this.isTextOverflow(f,t,"start")?"top":"bottom"},_={textAlign:"center",textBaseline:this.isTextOverflow(f,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,Va({},r,{text:p,x:m.x,y:m.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-start-text-${c}`),this._endText=this.maybeAddLabel(this._container,Va({},o,{text:g,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:_}),`data-zoom-end-text-${c}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Xo).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,y;h.visible?this._isHorizontal?(m=p,v=g-f,y={x:a.x,y:a.y+f}):(m=p-f,v=g,y={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,y=a);const _=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-=(_+b)/2,y={x:y.x+_/2,y:y.y}):(v-=(_+b)/2,y={x:y.x,y:y.y+_/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:y,width:m,height:v},this._layoutAttrFromConfig}render(){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,w,T,C,E,P,B,R,L;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:K,height:X}=this.getLayoutAttrFromConfig(),$=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:K,height:X,cursor:V?"crosshair":"auto"},I),{pickable:!G&&(null===(i=I.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y,width:(U-W)*K,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:K,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*K,y:Y.y-t,width:(U-W)*K,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*K,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},z.icon),{pickable:!G&&(null===(m=z.icon.pickable)||void 0===m||m)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*K,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},lP.horizontal),H),{pickable:!G&&(null===(y=H.pickable)||void 0===y||y)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*K,y:Y.y+X/2,size:X,symbolType:null!==(_=N.symbolType)&&void 0!==_?_:"square"},lP.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*K-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},lP.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*K-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},lP.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+K,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(k=null===(A=z.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+K+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=z.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+W*X,size:K,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},lP.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+K/2,y:Y.y+U*X,size:K,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},lP.vertical),N),{pickable:!G&&(null===(L=N.pickable)||void 0===L||L)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),$),e=Math.max(this._startHandler.AABBBounds.height(),$),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},lP.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+K/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},lP.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){if(t.length<=10)return t;const s=void 0!==e?e*e:1;return Qb(t=i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,s),s)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new IT(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;va(t)&&va(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...$a(a))}setPreviewPointsX(t){fa(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){fa(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){fa(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){fa(t)&&(this._previewPointsY1=t)}setStatePointToData(t){fa(t)&&(this._statePointToData=t)}};var pP,gP,fP,mP;function vP(){jw(),LT()}function yP(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 _P(t,e){const{dx:i,dy:s}=yP(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}uP.defaultAttributes=oP,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.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(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 bP extends nS{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=YC(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=KC(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=XC(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=ya(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:Va({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:Va({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:Va({},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=$m.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=$m.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=$m.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 xP(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 SP(t,e,i,s){t&&(xP(t.startSymbol,e,i,s),t.lines.forEach((t=>xP(t,e,i,s))),xP(t.line,e,i,s),xP(t.endSymbol,e,i,s))}function AP(t,e,i,s){t&&(xP(t.getTextShape(),e,i,s),xP(t.getBgRect(),e,i,s))}function kP(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 MP(t,e,i,s){t&&(kP(t.startSymbol,e,i,s),t.lines.forEach((t=>kP(t,e,i,s))),kP(t.line,e,i,s),kP(t.endSymbol,e,i,s))}function wP(t,e,i,s){t&&(kP(t.getTextShape(),e,i,s),kP(t.getBgRect(),e,i,s))}function TP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;xP(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)})),xP(t.endSymbol,s+r+a,o,n),xP(e.getTextShape(),s+r+a+o,l,n),xP(e.getBgRect(),s+r+a+o,l,n)}function CP(t,e,i,s,n){SP(t,s,i,n),AP(e,s,i,n)}function EP(t,e,i,s,n){xP(t,s,i,n),AP(e,s,i,n)}function PP(t,e,i,s,n){xP(t,s,i,n),AP(e,s,i,n)}function BP(t,e,i,s,n,r){var a;SP(t,n,s,r),xP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?AP(i,n,s,r):xP(i,n,s,r)}function RP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;xP(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)})),xP(e,n+o+l,h,r),xP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(xP(i.getTextShape(),n+o+l+h+c,d,r),xP(i.getBgRect(),n+o+l+c,d,r)):xP(i,n+o+l+c,d,r)}function LP(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?TP(t,e,s,r,a):"fadeIn"===i&&CP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?TP(t,e,s,n,a):"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){MP(t,s,i,n),wP(e,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&&EP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&EP(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),wP(e,s,i,n)}(t,e,i,s,n)}}function IP(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){kP(t,s,i,n),wP(e,s,i,n)}(t,e,i,s,n)}}function DP(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&&RP(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&&RP(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;MP(t,n,s,r),kP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?wP(i,n,s,r):kP(i,n,s,r)}(n,r,e,t,i,s)}}const FP={type:"clipIn",duration:500,easing:"linear",delay:0},jP={type:"fadeIn",duration:500,easing:"linear",delay:0},zP={type:"callIn",duration:500,easing:"linear",delay:0},HP={type:"fadeOut",duration:500,easing:"linear",delay:0};class NP extends bP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=FP,this.defaultExitAnimation=HP}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;_P(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new IT(Object.assign(Object.assign({},e),{state:{panel:Va({},lT,null==i?void 0:i.labelBackground),text:Va({},lT,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:Va({},lT,null==e?void 0:e.labelBackground),text:Va({},lT,null==e?void 0:e.label)}})),this.setLabelPos())}}const VP=.001,GP={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:{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]}},YP={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}},KP={interactive:!0,label:{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"}},qP={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 ZP(){JP._animate=LP}vP(),RC();class JP extends NP{markerAnimate(t){JP._animate&&this._animationConfig&&JP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},JP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(gT(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return fT(Math.abs(e),Math.PI/2,VP)||fT(Math.abs(e),3*Math.PI/2,VP)?mT(i,e,t):gT(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 OC({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:Va({},lT,null==a?void 0:a.line),startSymbol:Va({},lT,null==a?void 0:a.lineStartSymbol),endSymbol:Va({},lT,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:Va({},lT,null==a?void 0:a.line),startSymbol:Va({},lT,null==a?void 0:a.lineStartSymbol),endSymbol:Va({},lT,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=>{Ta(t.x)&&Ta(t.y)||(e=!1)}));else if(!Ta(t.x)||!Ta(t.y))return void(e=!1)})),e}}function QP(){tB._animate=OP}JP.defaultAttributes=GP,vP(),Yw();class tB extends bP{markerAnimate(t){tB._animate&&this._animationConfig&&tB._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},tB.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=jP,this.defaultExitAnimation=HP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},$P[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;_P(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=$m.polygon(Object.assign({points:e},s));r.states=Va({},lT,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new IT(Object.assign(Object.assign({},i),{state:{panel:Va({},lT,null==n?void 0:n.labelBackground),text:Va({},lT,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=Va({},lT,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:Va({},lT,null==s?void 0:s.labelBackground),text:Va({},lT,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{Ta(t.x)&&Ta(t.y)||(e=!1)})),e}}tB.defaultAttributes=YP,vP(),LC();class eB extends NP{markerAnimate(t){eB._animate&&this._animationConfig&&eB._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},eB.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case fP.arcInnerStart:l=s;case fP.arcOuterStart:l=s;break;case fP.arcInnerEnd:l=n;case fP.arcOuterEnd:l=n;break;case fP.center:case fP.arcInnerMiddle:case fP.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return XP[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new IC({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:Va({},lT,null==o?void 0:o.line),startSymbol:Va({},lT,null==o?void 0:o.lineStartSymbol),endSymbol:Va({},lT,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:Va({},lT,null==o?void 0:o.line),startSymbol:Va({},lT,null==o?void 0:o.lineStartSymbol),endSymbol:Va({},lT,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}eB.defaultAttributes=UP,vP(),Pw();class iB extends bP{markerAnimate(t){iB._animate&&this._animationConfig&&iB._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},iB.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=jP,this.defaultExitAnimation=HP}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case fP.center:h=(i+s)/2,c=(n+r)/2;break;case fP.arcInnerStart:h=i,c=n;break;case fP.arcOuterStart:h=s,c=n;break;case fP.arcInnerEnd:h=i,c=r;break;case fP.arcOuterEnd:h=s,c=r;break;case fP.arcInnerMiddle:h=i,c=(n+r)/2;break;case fP.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},XP[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;_P(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=$m.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=Va({},lT,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new IT(Object.assign(Object.assign({},o),{state:{panel:Va({},lT,null==l?void 0:l.labelBackground),text:Va({},lT,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=Va({},lT,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:Va({},lT,null==o?void 0:o.labelBackground),text:Va({},lT,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function sB(){nB._animate=DP}iB.defaultAttributes=KP,vP(),RC(),LC(),tT(),Hw(),Vw();class nB extends bP{markerAnimate(t){nB._animate&&this._animationConfig&&nB._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},nB.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=zP,this.defaultExitAnimation=HP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return fT(Math.abs(s),Math.PI/2,VP)||fT(Math.abs(s),3*Math.PI/2,VP)?mT(t,s,n):gT(s)?qP.postiveXAxis[n]:qP.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=mP.middle}=e,{state:f}=this.attribute,m=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(m)+h*Math.cos(m-Math.PI/2),y=l*Math.sin(m)+h*Math.sin(m-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,m,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:Va({},lT,null==f?void 0:f.textBackground),text:Va({},lT,null==f?void 0:f.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=Va({},lT,null==f?void 0:f.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=Va({},lT,null==f?void 0:f.image));const _=gT(m)?m:m-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(y||0),angle:o&&_+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=$m.symbol(Object.assign(Object.assign({},i),r)),h.states=Va({},lT,null==s?void 0:s.symbol)):"text"===n?h=new IT(Object.assign(Object.assign({},i),{state:{panel:Va({},lT,null==s?void 0:s.textBackground),text:Va({},lT,null==s?void 0:s.text)}})):"richText"===n?(h=$m.richtext(Object.assign(Object.assign({},i),a)),h.states=Va({},lT,null==s?void 0:s.richText)):"image"===n?(h=$m.image(Object.assign(Object.assign({},i),o)),h.states=Va({},lT,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=Va({},lT,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=fT(c,0,VP)||fT(d,0,VP),this._isArcLine){const{x:t,y:s}=e,{x:l,y:c}=i,d=(t+l)/2,u=d+h*(c>s?-1:1)*d,p=(s===c?0:-(t-l)/(s-c))*(u-d)+(s+c)/2;a=RT(s-p,t-u),o=RT(c-p,l-u),n={x:u,y:p},h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(pB.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(pB.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===pB.focus||"focus"===o){const s=a.hasState(dB.focus);a.toggleState(dB.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[dB.unSelected,dB.unSelectedHover,dB.focus],t),this._setLegendItemState(e,dB.selected,t)})):(this._setLegendItemState(a,dB.selected,t),this._removeLegendItemState(a,[dB.unSelected,dB.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[dB.selected,dB.selectedHover,dB.focus],t),this._setLegendItemState(e,dB.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(dB.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(dB.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(uB.legendItemClick,a,t);i?(this._removeLegendItemState(a,[dB.selected,dB.selectedHover],t),this._setLegendItemState(a,dB.unSelected,t)):(this._setLegendItemState(a,dB.selected,t),this._removeLegendItemState(a,[dB.unSelected,dB.unSelectedHover],t))}else this._setLegendItemState(a,dB.selected,t),this._removeLegendItemState(a,[dB.unSelected,dB.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[dB.selected,dB.selectedHover],t),this._setLegendItemState(e,dB.unSelected,t))}))}this._dispatchLegendEvent(uB.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,dB.selected),this._removeLegendItemState(e,[dB.unSelected,dB.unSelectedHover])):(this._removeLegendItemState(e,[dB.selected,dB.selectedHover]),this._setLegendItemState(e,dB.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,maxHeight:n,defaultSelected:r,lazyload:a,autoPage:o}=this.attribute,{spaceCol:l=lB,spaceRow:h=hB}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:p,isScrollbar:g}=this._itemContext,f=g?1:u?i:e;let m,{doWrap:v,maxWidthInCol:y,startX:_,startY:b,pages:x}=this._itemContext;for(let t=p,e=d.length;tthis._itemContext.currentPage*f);t++){a&&(this._itemContext.startIndex=t+1),m=d[t],m.id||(m.id=m.label),m.index=t;let e=!0;Aa(r)&&(e=r.includes(m.label));const i=this._renderEachItem(m,e,t,d),p=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),y=Math.max(p,y),this._itemMaxWidth=Math.max(p,this._itemMaxWidth),u?(va(s)&&(g&&o?(x=Math.ceil((_+p)/s),v=x>1):_+p>s&&(v=!0,_>0&&(x+=1,_=0,b+=f+h))),0===_&&0===b||i.setAttributes({x:_,y:b}),_+=l+p):(va(n)&&(g&&o?(x=Math.ceil((b+f)/n),v=x>1):nthis._itemContext.maxPages&&(g=this._renderPagerComponent()),g||(r.setAttribute("y",this._title?this._title.AABBBounds.height()+Ia(this.attribute,"title.space",8):0),this._innerView.add(r))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:u,align:p,autoEllipsisStrategy:g}=this.attribute.item,{shape:f,label:m,value:v,background:y}=this.attribute.item,_=this._handleStyle(f,t,e,i,s),b=this._handleStyle(m,t,e,i,s),x=this._handleStyle(v,t,e,i,s),S=this._handleStyle(y,t,e,i,s),A=Nl(c);let k;!1===y.visible?(k=$m.group({x:0,y:0,cursor:null===(n=S.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(k,pB.item,t,k)):(k=$m.group(Object.assign({x:0,y:0},S.style)),this._appendDataToShape(k,pB.item,t,k,S.state)),k.id=`${null!=a?a:o}-${i}`,k.addState(e?dB.selected:dB.unSelected);const M=$m.group({x:0,y:0,pickable:!1});k.add(M);let w,T=0,C=0,E=0;if(f&&!1!==f.visible){const i=Ia(_,"style.size",10);C=Aa(i)?i[0]||0:i,E=Ia(f,"space",8);const s=$m.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),_.style));Object.keys(_.state||{}).forEach((t=>{const e=_.state[t].fill||_.state[t].stroke;h.fill&&ma(_.state[t].fill)&&e&&(_.state[t].fill=e),h.stroke&&ma(_.state[t].stroke)&&e&&(_.state[t].stroke=e)})),this._appendDataToShape(s,pB.itemShape,t,k,_.state),s.addState(e?dB.selected:dB.unSelected),M.add(s)}let P=0;if(d){const e=Ia(u,"size",10);w=$m.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!0,pickMode:"imprecise",boundsPadding:A})),this._appendDataToShape(w,pB.focus,t,k),P=e}const B=m.formatMethod?m.formatMethod(o,t,i):o,R=PT(Object.assign(Object.assign({x:C/2+E,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=b.style)||void 0===r?void 0:r.fontSize},b.style),{text:B,_originText:m.formatMethod?o:void 0}));this._appendDataToShape(R,pB.itemLabel,t,k,b.state),R.addState(e?dB.selected:dB.unSelected),M.add(R);const L=Ia(m,"space",8);if(va(l)){const s=Ia(v,"space",d?8:0),n=v.formatMethod?v.formatMethod(l,t,i):l,r=PT(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:x.style.fontSize},x.style),{text:n,_originText:v.formatMethod?l:void 0}));if(this._appendDataToShape(r,pB.itemValue,t,k,x.state),r.addState(e?dB.selected:dB.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-A[1]-A[3]-C-E-L-P-s;this._autoEllipsis(g,t,R,r),v.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-C/2-A[1]-A[3]-P-s}):r.setAttribute("x",s+(R.AABBBounds.empty()?0:R.AABBBounds.x2))}else r.setAttribute("x",s+(R.AABBBounds.empty()?0:R.AABBBounds.x2));T=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(R.setAttribute("maxLineWidth",this._itemWidthByUser-A[1]-A[3]-C-E-P),T=L+(R.AABBBounds.empty()?0:R.AABBBounds.x2)):T=L+(R.AABBBounds.empty()?0:R.AABBBounds.x2);w&&(w.setAttribute("x",T),M.add(w));const O=M.AABBBounds,I=O.width();if("right"===p){const t=O.x2,e=O.x1;M.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===w?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 D=O.height(),F=va(this.attribute.item.width)?this.attribute.item.width:I+A[1]+A[3],j=this._itemHeightByUser||D+A[0]+A[2];return k.attribute.width=F,k.attribute.height=j,w&&w.setAttribute("visible",!1),M.translateTo(-O.x1+A[3],-O.y1+A[0]),k}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute;return this._itemContext.isHorizontal?new oB(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:99},Va({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new oB(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new dT(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new dT(Object.assign(Object.assign({direction:"vertical",width:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i,s,n){const{maxHeight:r,pager:a}=this.attribute,{totalPage:o,isHorizontal:l}=this._itemContext,h=a&&a.position||"middle";if(this._pagerComponent.setTotal(o),l){let e;e="start"===h?i:"end"===h?i+n-this._pagerComponent.AABBBounds.height()/2:i+n/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:t,y:e})}else{let t;t="start"===h?0:"end"===h?s-this._pagerComponent.AABBBounds.width():(s-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:r-this._pagerComponent.AABBBounds.height()})}}_updatePositionOfScrollbar(t,e,i){const{currentPage:s,totalPage:n,isHorizontal:r}=this._itemContext;this._pagerComponent.setScrollRange([(s-1)/n,s/n]),r?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let s=e[0]*this._itemContext.totalPage;return i.scrollByPosition?s+=1:s=Math.floor(s)+1,s}:t=>t.detail.current,o=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndex{const{width:i,height:s}=t.attribute;v<_+i&&(_=0,b+=s+l,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=o+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(v,y,t,f,m)}else{if(f=this._itemMaxWidth*s+(s-1)*o,m=i,v=f,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),y=i-g.AABBBounds.height()-c-t,y<=0)return this._innerView.removeChild(g),!1;h.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:_,y:b}),b+=l+i}));const e=Math.ceil(x/s);this._itemContext.totalPage=e,this._updatePositionOfPager(v,y,t,f,m)}d>1&&(p?h.setAttribute("y",-(d-1)*(m+l)):h.setAttribute("x",-(d-1)*(f+o)));const S=$m.group({x:0,y:t,width:p?v:f,height:p?m:y,clip:!0,pickable:!1});return S.add(h),this._innerView.add(S),this._bindEventsOfPager(p?m+l:f+o,p?"y":"x"),!0}_renderScrollbar(){const t=this._title?this._title.AABBBounds.height()+Ia(this.attribute,"title.space",8):0,{maxWidth:e,maxHeight:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=lB,spaceRow:a=hB}=s,o=this._itemsContainer,{space:l=cB,defaultCurrent:h=1}=n,c=vB(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext;let u,p=0,g=0,f=0,m=0,v=1;if(d)p=e,g=e,f=this._itemHeight,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),this._updatePositionOfScrollbar(g,f,t);else{if(p=i,u=this._createScrollbar(c,p),this._pagerComponent=u,this._innerView.add(u),f=i-t,g=this._itemMaxWidth,f<=0)return this._innerView.removeChild(u),!1;o.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;v=Math.floor((m+i)/f)+1,m+=a+i})),this._itemContext.totalPage=v,this._itemContext.pages=v,this._updatePositionOfScrollbar(g,f,t)}h>1&&(d?o.setAttribute("x",-(h-1)*(g+r)):o.setAttribute("y",-(h-1)*(f+a)));const y=$m.group({x:0,y:t,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(dB.selected)?this._setLegendItemState(t,dB.selectedHover,e):this._setLegendItemState(t,dB.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===pB.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(uB.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(dB.unSelectedHover)||t.hasState(dB.selectedHover))&&(i=!0),t.removeState(dB.unSelectedHover),t.removeState(dB.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(dB.unSelectedHover)&&!t.hasState(dB.selectedHover)||(i=!0),t.removeState(dB.unSelectedHover),t.removeState(dB.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===pB.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(uB.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(uB.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!==pB.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(uB.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!==pB.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(uB.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(dB.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=Va({},yB,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(dB.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(fa(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]&&(fa(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}};var bB;function xB(t){return Aa(t)?t:[t,t]}function SB(t){return t?"ew-resize":"ns-resize"}_B.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:lB,spaceRow:hB,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:cB,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"}(bB||(bB={})),fB();class AB extends nS{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:Va({},AB.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=mo(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===db.env?(db.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),db.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=mo(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===db.env?(db.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),db.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===db.env?(db.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),db.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?mo(t+p,h,c):mo(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?mo(t+p,0,c-h):mo(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===db.env?(db.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),db.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(va(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]=$a(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;ma(d)&&(d=[o,l]),this._currentValue={startValue:xB(d)[0],endValue:xB(d)[1]};const u="horizontal"===i;this._isHorizontal=u;const p=$m.group({x:0,y:0});p.name=bB.innerView,this.add(p),this._innerView=p;let g,f=0;if(r&&r.visible){g=$m.text(Object.assign({x:u?0:s/2,y:u?n/2:0,textAlign:u?"start":"center",textBaseline:u?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),g.name=bB.startText,p.add(g);const e=va(r.space)?r.space:0;f+=(u?g.AABBBounds.width():g.AABBBounds.height())+e}const m=$m.group({x:u?f:0,y:u?0:f});p.add(m);const v=$m.group({x:0,y:0});let y;if(v.name=bB.railContainer,this._railContainer=v,m.add(v),this._mainContainer=m,this._renderRail(v),f+=u?s:n,a&&a.visible){const t=va(a.space)?a.space:0;y=$m.text(Object.assign({x:u?f+t:s/2,y:u?n/2:f+t,textAlign:u?"start":"center",textBaseline:u?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),y.name=bB.endText,p.add(y)}this._renderTrack(v),h&&(this._renderHandlers(m),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=$m.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=bB.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;ma(c)&&(c=[i,s]);const d=a&&a.visible,u=this._isHorizontal,[p,g]=xB(c),f=this.calculatePosByValue(p,e?"start":"end"),m=this._renderHandler(Object.assign({x:u?f:l/2,y:u?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":SB(u)},r));if(m.name=bB.startHandler,this._startHandler=m,t.add(m),this._currentValue.startPos=f,d){const i=this._renderHandlerText(p,e?"start":"end");i.name=bB.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(g,"end"),i=this._renderHandler(Object.assign({x:u?e:l/2,y:u?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":SB(u)},r));if(i.name=bB.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(g,"end");e.name=bB.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(ma(h))e?(c=i,d=s):c=d=i;else if(e){const t=vo(h,i,s);c=t[0],d=t[1]}else c=i,d=mo(h,i,s);const u=this._isHorizontal;e||(c=i);const p=$m.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});p.name=bB.trackContainer;const g=ya(e)&&!0===e.draggableTrack;let f;f=!1===l?"default":!1===e||!1===g?"pointer":SB(u);const m=this.calculatePosByValue(c,"start"),v=this.calculatePosByValue(d,e?"end":"start"),y=$m.rect(Object.assign({x:u?Math.min(m,v):0,y:u?0:Math.min(m,v),width:u?Math.abs(v-m):r,height:u?n:Math.abs(v-m),cursor:f},a));y.name=bB.track,this._track=y,p.add(y),t.add(p)}_renderHandler(t){return $m.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":SB(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),$m.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=$m.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=$m.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),ya(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===bB.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===bB.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===bB.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===bB.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}}}AB.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}}},mB(),fB();class kB extends gB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},kB.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!ma(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:y,inverse:_,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 MB(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}kB.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"}}},mB(),fB(),Ww();class wB extends gB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},wB.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:y,disableTriggerEvent:_,inverse:b}=this.attribute,x=$m.group({x:0,y:0});this._innerView.add(x);const S=new AB({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:MB(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:_,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=$m.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+Ia(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))}}wB.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)"}},jw(),iT(),qw();let TB=class t extends nS{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:Va({},t.defaultAttributes,e)),this.name="title"}render(){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,w,T,C,E,P,B,R,L,O,I,D,F,j,z,H,N;const{textType:V,text:G,subtextType:W,textStyle:U={},subtext:Y,subtextStyle:K={},width:X,height:$,minWidth:q,maxWidth:Z,minHeight:J,maxHeight:Q,align:tt,verticalAlign:et,padding:it=0}=this.attribute,st=Nl(it),nt=this.createOrUpdateChild("title-container",{x:st[3],y:st[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==U.visible)if("rich"===V||va(U.character)){const h=Object.assign({x:null!==(t=U.x)&&void 0!==t?t:0,y:null!==(e=U.y)&&void 0!==e?e:0,width:null!==(s=null!==(i=U.width)&&void 0!==i?i:X)&&void 0!==s?s:0,height:null!==(r=null!==(n=U.height)&&void 0!==n?n:$)&&void 0!==r?r:0,ellipsis:null===(a=U.ellipsis)||void 0===a||a,wordBreak:null!==(o=U.wordBreak)&&void 0!==o?o:"break-word",maxHeight:U.maxHeight,maxWidth:U.maxWidth,textConfig:null!==(l=U.character)&&void 0!==l?l:G},U);this._mainTitle=nt.createOrUpdateChild("mainTitle",h,"richtext")}else if("html"===V){const t=Object.assign({html:Object.assign(Object.assign({dom:G},hT),U),x:null!==(h=U.x)&&void 0!==h?h:0,y:null!==(c=U.y)&&void 0!==c?c:0,width:null!==(u=null!==(d=U.width)&&void 0!==d?d:X)&&void 0!==u?u:0,height:null!==(g=null!==(p=U.height)&&void 0!==p?p:$)&&void 0!==g?g:0,ellipsis:null===(f=U.ellipsis)||void 0===f||f,wordBreak:null!==(m=U.wordBreak)&&void 0!==m?m:"break-word",maxHeight:U.maxHeight,maxWidth:U.maxWidth,textConfig:[]},U);this._mainTitle=nt.createOrUpdateChild("mainTitle",t,"richtext")}else va(G)&&(this._mainTitle=nt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:Aa(G)?G:[G],wrap:!0},U),{maxLineWidth:null!==(v=U.maxLineWidth)&&void 0!==v?v:X,heightLimit:U.heightLimit,lineClamp:U.lineClamp,ellipsis:null===(y=U.ellipsis)||void 0===y||y,x:0,y:0}),"text"));const rt=this._mainTitle?this._mainTitle.AABBBounds.height():0,at=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==K.visible)if("rich"===W||va(K.character)){const t=Object.assign({x:null!==(_=K.x)&&void 0!==_?_:0,y:null!==(b=K.y)&&void 0!==b?b:0,width:null!==(S=null!==(x=K.width)&&void 0!==x?x:X)&&void 0!==S?S:0,height:null!==(k=null!==(A=K.height)&&void 0!==A?A:$)&&void 0!==k?k:0,ellipsis:null===(M=K.ellipsis)||void 0===M||M,wordBreak:null!==(w=K.wordBreak)&&void 0!==w?w:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:null!==(T=K.character)&&void 0!==T?T:Y},K);this._subTitle=nt.createOrUpdateChild("subTitle",t,"richtext")}else if("html"===W){const t=Object.assign({html:Object.assign(Object.assign({dom:Y},hT),K),x:null!==(C=K.x)&&void 0!==C?C:0,y:null!==(E=K.y)&&void 0!==E?E:0,width:null!==(B=null!==(P=K.width)&&void 0!==P?P:X)&&void 0!==B?B:0,height:null!==(L=null!==(R=K.height)&&void 0!==R?R:$)&&void 0!==L?L:0,ellipsis:null===(O=K.ellipsis)||void 0===O||O,wordBreak:null!==(I=K.wordBreak)&&void 0!==I?I:"break-word",maxHeight:K.maxHeight,maxWidth:K.maxWidth,textConfig:[]},K);this._subTitle=nt.createOrUpdateChild("subTitle",t,"richtext")}else va(Y)&&(this._subTitle=nt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:Aa(Y)?Y:[Y],wrap:!0},K),{maxLineWidth:null!==(D=K.maxLineWidth)&&void 0!==D?D:X,heightLimit:K.heightLimit,lineClamp:K.lineClamp,ellipsis:null===(F=K.ellipsis)||void 0===F||F,x:0,y:rt}),"text"));const ot=this._subTitle?this._subTitle.AABBBounds.height():0,lt=this._subTitle?this._subTitle.AABBBounds.width():0;let ht=Math.max(at,lt),ct=rt+(null!==(j=K.height)&&void 0!==j?j:ot);if(va(X)&&(ht=X,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",X),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",X)),va($)&&(ct=$),va(q)&&htZ&&(ht=Z)),va(J)&&ctQ&&(ct=Q)),nt.attribute.width=ht,nt.attribute.height=ct,nt.attribute.boundsPadding=st,this._mainTitle){if(va(tt)||va(U.align)){const t=U.align?U.align:tt,e=null!==(z=U.width)&&void 0!==z?z:at;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(va(et)||va(U.verticalAlign)){const t=U.verticalAlign?U.verticalAlign:et,e=U.height?U.height:ct;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(va(tt)||va(K.align)){const t=K.align?K.align:tt,e=null!==(H=K.width)&&void 0!==H?H:lt;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(va(et)||va(U.verticalAlign)){const t=K.verticalAlign?K.verticalAlign:et,e=rt,i=null!==(N=K.height)&&void 0!==N?N:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};TB.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 CB={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"}}};jw(),iT(),qw();let EB=class extends nS{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(va(i))if(!1!==i.visible){const t=Va({},Ia(CB,"title.style"),i.style);TT(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},ET(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:va(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&Ta(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&Ta(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(va(s)){const t=$a(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=Va({},Ia(CB,"content.style"),t.style);let l;l=TT(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},ET(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:va(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&Ta(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&Ta(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=wT(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",va(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,$a(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 p=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,g=c/2,f=p**2+1,m=2*g*p,v=g**2-l**2,y=2*(p*((-m+Math.sqrt(m**2-4*f*v))/(2*f))+g),_=(y-c)/h.length;Ta(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",_),t.text.setAttribute("lineHeight",va(i)?i:_)}))}_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;$a(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 PB extends em{constructor(t){super(t)}}var BB,RB;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(BB||(BB={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(RB||(RB={}));class LB extends nS{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},LB.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"},LB.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"},LB.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},LB.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},LB.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=()=>{ma(this._playController)&&(this._playController=new PB(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{ma(this._backwardController)&&(this._backwardController=new PB(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{ma(this._forwardController)&&(this._forwardController=new PB(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(BB.OnPlay)},this.pause=()=>{this._dispatchEvent(BB.OnPause)},this.forward=()=>{this._dispatchEvent(BB.OnForward)},this.backward=()=>{this._dispatchEvent(BB.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()}}LB.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},LB.defaultAttributes={[RB.Start]:{},[RB.Pause]:{},[RB.Backward]:{},[RB.Forward]:{}};const OB={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},IB=[200,10];var DB,FB;!function(t){t.Default="default",t.Reverse="reverse"}(DB||(DB={})),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"}(FB||(FB={}));const jB=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===DB.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===DB.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},zB=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===DB.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===DB.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},HB=t=>"top"===t||"bottom"===t;class NB extends nS{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},NB.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;Ta(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Io(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:Ta(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(HB(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:IB[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:IB[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 AB(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 HB(this._orient)?(t.layout="horizontal",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(t.layout="vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new LB(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=HB(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:IB[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=wa(i)?i:Io(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(HB(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=wa(n)?n:Io(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:HB(this._orient)?t+s:(this._size.width-r)/2,y:HB(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:HB(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:HB(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=wa(n)?n:Io(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:HB(this._orient)?t+s:(this._size.width-r)/2,y:HB(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function VB(){fB(),jw(),tT()}NB.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({},OB),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},OB),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},OB),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},OB),{key:"backward",position:"start"})}},VB();class GB extends NB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:Va({},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:DB.Default},this._initDataIndex=()=>{var t;this._dataIndex=ma(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(BB.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(BB.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(BB.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(BB.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(FB.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(jB({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||zB({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===DB.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(FB.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=db.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(FB.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(FB.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=db.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(),db.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(FB.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,db.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(FB.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(FB.change),this.dispatchCustomEvent(FB.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var WB,UB=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())}))};VB();class YB extends NB{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(BB.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(BB.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(BB.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(BB.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(FB.change))},this.play=()=>UB(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(FB.play),this._rafId=db.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=db.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,db.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(FB.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,db.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(FB.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(FB.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(FB.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(WB||(WB={}));const KB={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},XB=5;const $B={debounce:bo,throttle:xo};jw(),Yw();let qB=class t extends nS{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:Va({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:$B[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(WB.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(WB.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(WB.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=KB.trigger,updateTrigger:e=KB.updateTrigger,endTrigger:i=KB.endTrigger,resetTrigger:s=KB.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Il(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(WB.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(WB.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=XB,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(WB.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(WB.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:ja(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=$m.polygon(Object.assign(Object.assign({points:ja(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return Va(t,...i,{shape:n.every(ma)?void 0:Va({},...n),key:r.every(ma)?void 0:Va({},...r),value:a.every(ma)?void 0:Va({},...a)})},JB=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:$a(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}},QB={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:aT,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:aT,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:aT,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new $o).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},tR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];jw(),Xw(),tT(),iT(),qw();let eR=class t extends nS{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:Va({},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=Nl(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",Va({symbolType:"circle"},u.shape,{visible:pT(u)&&pT(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:pT(u)&&pT(u.value)},JB(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:pT(u)&&pT(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:pT(u)&&pT(u.value)},JB(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},hT),u.value),visible:pT(u)&&pT(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 p=pT(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:g,textBaseline:f}=u.value,m=n.width-d[3]-d[0]-p;"center"===g?this._tooltipTitle.setAttribute("x",p+m/2):"right"===g||"end"===g?this._tooltipTitle.setAttribute("x",p+m):this._tooltipTitle.setAttribute("x",p),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const v=pT(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]+v);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!pT(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)+(pT(n.key)?r+n.key.spacing:0)+(pT(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 p=this._createKey(n,h,l);p&&(BT(c,p,n.key.textAlign,u,r),p.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const g=this._createValue(n,h,l);if(g){let t="right";va(n.value.textAlign)?t=n.value.textAlign:pT(n.key)||"right"===c||(t="left"),g.setAttribute("textAlign",t),BT(c,g,t,u,a),g.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(pT(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=yu(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(pT(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},JB(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},JB(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},hT),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(pT(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},JB(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},JB(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=>tR.includes(t)))?(this._mergeAttributes(e,s),ma(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)&&pT(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=pT(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=MT(u),_=MT(p);let b=0;if(pT(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(pT(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&Zf[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return ZB({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return ZB({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};eR.defaultAttributes=QB;const iR=nt;function sR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:U(i)}function nR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:W(i)}function rR(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function aR(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 oR(t,e){const i=aR(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 lR(t,e){const i=hR(t),s=hR(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 hR(t,e={x:0,y:0}){return Mt.distancePP(t,e)}function cR(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 dR(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const uR=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var gR;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(gR||(gR={}));const fR={};function mR(t){switch(t){case gR.Linear:case gR.Log:case gR.Pow:case gR.Sqrt:case gR.Symlog:case gR.Time:return!0;default:return!1}}function vR(t){return!!fR[t]}function yR(t){switch(t){case gR.Ordinal:case gR.Point:case gR.Band:return!0;default:return!1}}function _R(t){return t}Object.values(gR).forEach((t=>{fR[t]=!0}));const bR=t=>-Math.log(-t),xR=t=>-Math.exp(-t),SR=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,AR=t=>10===t?SR:t===Math.E?Math.exp:e=>Math.pow(t,e),kR=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),MR=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),wR=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function TR(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 CR(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function ER(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function PR(t,e,i,s){return 1===i&&(i=0),ER(t,i,s)*(e/(1-i))}function BR(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function RR(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class IR{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=BR(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=lt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const DR=Symbol("implicit");class FR extends IR{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=gR.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=DR}clone(){const t=(new FR).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!==DR)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return n&&r.reverse(),r}class zR extends FR{constructor(t){super(),this.type=gR.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=PR(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[K(t[0]),K(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[K(t[0]),K(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:jR(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return jR(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const s=[];let n;if(i=ht(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),n=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new zR(!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:HR}=Wt;function NR(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return pt(t,e);if("string"===i){if(s=Vt.parseColorString(e)){const e=HR(Vt.parseColorString(t),s);return t=>e(t).formatRgb()}return pt(Number(t),Number(e))}return e instanceof Gt?HR(t,e):e instanceof Vt?HR(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):pt(Number(t),Number(e))}class VR extends IR{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_R,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_R;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=_R,this._piecewise=CR,this._interpolate=NR}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),pt)),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,K);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=gt,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=ht(i[0],i[r-1])),this._piecewise=r>2?RR:CR,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:_R),this.rescale(i)):this._clamp!==_R}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const GR=Math.sqrt(50),WR=Math.sqrt(10),UR=Math.sqrt(2),YR=[1,2,5,10],KR=(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=ZR(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?$R(0,-(e-1)/s,s):$R((e-1)/s,0,s)},XR=ot(((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 KR(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return KR(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=$R(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=$R(t,e,l);return n&&r.reverse(),r})),ZR=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=YR[0];return i>=GR?s=YR[3]:i>=WR?s=YR[2]:i>=UR&&(s=YR[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function JR(t,e,i){const s=(e-t)/Math.max(0,i);return ZR(s)}function QR(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=JR(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function eL(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 iL=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),sL=ot(((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})),nL=ot(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=qR(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?iL(t,e,n):iL(t,e,OR(n)),h=iL(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),rL=ot(((t,e,i,s,n)=>QR(s(t),s(e),i).map((t=>OR(n(t))))));class aL extends VR{constructor(){super(...arguments),this.type=gR.Linear}clone(){return(new aL).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return XR(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=qR(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return QR(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=eL(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=tL(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=tL(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=tL(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function oL(t){return e=>-t(-e)}function lL(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class hL extends VR{constructor(){super(kR(10),AR(10)),this.type=gR.Log,this._limit=lL(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new hL).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=kR(this._base),s=AR(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=oL(i),this._pows=oL(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=bR,this.untransformer=xR):(this._logs=i,this._pows=s,this._limit=lL(),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 _R}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return sL(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return nL(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rL(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return rL(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=eL(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=LR(s.slice(),{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class cL extends aL{constructor(){super(MR(1),wR(1)),this.type=gR.Symlog,this._const=1}clone(){return(new cL).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=MR(t),this.untransformer=wR(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return sL(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return nL(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rL(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return rL(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const s=this._domain;let n=[],r=null;if(t){const e=eL(s,t);if(n=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=LR(s.slice(),{floor:t=>Math.floor(t),ceil:t=>Math.ceil(t)});return"min"===r?t[t.length-1]=null!==(e=n[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=n[0])&&void 0!==i?i:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class dL{constructor(){this.type=gR.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[J(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 dL).domain(this._domain).range(this._range).unknown(this._unknown)}}var uL,pL;!function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn"}(uL||(uL={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(pL||(pL={}));const gL="__VCHART",fL=500,mL=500,vL=`${gL}_LABEL_LIMIT`,yL=`${gL}_LABEL_ALIGN`,_L=`${gL}_LABEL_TEXT`,bL=`${gL}_LABEL_VISIBLE`,xL=`${gL}_LABEL_X`,SL=`${gL}_LABEL_Y`,AL=`${gL}_ARC_TRANSFORM_VALUE`,kL=`${gL}_ARC_RATIO`,ML=`${gL}_ARC_START_ANGLE`,wL=`${gL}_ARC_END_ANGLE`,TL=`${gL}_ARC_K`,CL=`${gL}_ARC_MIDDLE_ANGLE`,EL=`${gL}_ARC_QUADRANT`,PL=`${gL}_ARC_RADIAN`,BL=-Math.PI/2,RL=3*Math.PI/2,LL=-90,OL=.6;var IL,DL,FL,jL,zL,HL,NL,VL,GL,WL,UL,YL,KL,XL,$L;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(IL||(IL={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(DL||(DL={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(FL||(FL={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(jL||(jL={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(zL||(zL={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(HL||(HL={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(NL||(NL={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(VL||(VL={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(GL||(GL={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(WL||(WL={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(UL||(UL={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(YL||(YL={})),t.VGRAMMAR_HOOK_EVENT=void 0,(KL=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",KL.AFTER_EVALUATE_DATA="afterEvaluateData",KL.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",KL.AFTER_EVALUATE_SCALE="afterEvaluateScale",KL.BEFORE_PARSE_VIEW="beforeParseView",KL.AFTER_PARSE_VIEW="afterParseView",KL.BEFORE_TRANSFORM="beforeTransform",KL.AFTER_TRANSFORM="afterTransform",KL.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",KL.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",KL.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",KL.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",KL.BEFORE_STAGE_RESIZE="beforeStageResize",KL.AFTER_STAGE_RESIZE="afterStageResize",KL.BEFORE_VRENDER_DRAW="beforeVRenderDraw",KL.AFTER_VRENDER_DRAW="afterVRenderDraw",KL.BEFORE_MARK_JOIN="beforeMarkJoin",KL.AFTER_MARK_JOIN="afterMarkJoin",KL.BEFORE_MARK_UPDATE="beforeMarkUpdate",KL.AFTER_MARK_UPDATE="afterMarkUpdate",KL.BEFORE_MARK_STATE="beforeMarkState",KL.AFTER_MARK_STATE="afterMarkState",KL.BEFORE_MARK_ENCODE="beforeMarkEncode",KL.AFTER_MARK_ENCODE="afterMarkEncode",KL.BEFORE_DO_LAYOUT="beforeDoLayout",KL.AFTER_DO_LAYOUT="afterDoLayout",KL.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",KL.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",KL.BEFORE_DO_RENDER="beforeDoRender",KL.AFTER_DO_RENDER="afterDoRender",KL.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",KL.AFTER_MARK_RENDER_END="afterMarkRenderEnd",KL.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",KL.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",KL.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",KL.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",KL.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",KL.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",KL.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",KL.BEFORE_ELEMENT_STATE="beforeElementState",KL.AFTER_ELEMENT_STATE="afterElementState",KL.BEFORE_ELEMENT_ENCODE="beforeElementEncode",KL.AFTER_ELEMENT_ENCODE="afterElementEncode",KL.ANIMATION_START="animationStart",KL.ANIMATION_END="animationEnd",KL.ELEMENT_ANIMATION_START="elementAnimationStart",KL.ELEMENT_ANIMATION_END="elementAnimationEnd",KL.ALL_ANIMATION_START="allAnimationStart",KL.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(XL||(XL={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}($L||($L={}));const qL="__vgrammar_scene_item__",ZL=[FL.line,FL.area],JL=[FL.arc3d,FL.rect3d,FL.pyramid3d],QL="key",tO=[{}],eO=["key"],iO=!0,sO=!0,nO=!1,rO=!0,aO="VGRAMMAR_IMMEDIATE_ANIMATION",oO=0,lO=1e3,hO=0,cO=0,dO=!1,uO=!1,pO="quintInOut",gO={stopWhenStateChange:!1,immediatelyApply:!0};function fO(t,e){return $a(t).reduce(((t,i)=>{const s=Sa(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function mO(t,e){if(ma(t))return[];if(!fa(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(Sa(i))return $a(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!fa(t)&&!!(null==t?void 0:t.callback)}(t))return fO(t.dependency,e);var i;return[]}function vO(t){return fa(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function yO(t,e,i,s){if(ma(t))return t;if(fa(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return Sa(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function _O(t,e){return bO(t)?t.output():e[t]}const bO=t=>t&&!ma(t.grammarType),xO=t=>fa(t)?t:e=>e[t];function SO(t){return!!(null==t?void 0:t.scale)}function AO(t){return!!(null==t?void 0:t.field)}function kO(t,e){if(!t)return[];let i=[];return t.scale&&(i=bO(t.scale)?[t.scale]:$a(e.getScaleById(t.scale))),i.concat(mO(t,e))}function MO(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function wO(t,e,i,s,n){i&&(vO(i)?e.forEach((e=>{const n=yO(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case FL.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case FL.group:case FL.rect:case FL.image:return["width","height","y1"].includes(e);case FL.path:case FL.shape:return["path","customPath"].includes(e);case FL.line:return"defined"===e;case FL.area:return["x1","y1","defined"].includes(e);case FL.rule:return["x1","y1"].includes(e);case FL.symbol:return"size"===e;case FL.polygon:return"points"===e;case FL.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(SO(l)){const t=_O(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!ma(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=Sa(null==l?void 0:l.field),c=n?Yx(l.field):null;let d=n?null:ma(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=wa(d)||wa(i)?d+e+i:d}))}else if(AO(l)){const t=Yx(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=yO(l,s,e.datum,t)}))})))}function TO(t,e,i,s){if(!t)return null;if(vO(t))return yO(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(SO(h)){const t=_O(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!ma(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=Sa(null==h?void 0:h.field),u=d?Yx(h.field):null,p=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,u(e)):ma(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=wa(p)||wa(c)?p+i+c:p}else if(AO(h)){const t=Yx(h.field);n[r]=t(e)}else n[r]=yO(h,s,e,i)})),n}class CO{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return Sa(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=$a(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let EO=class t{static registerPlotMarks(e,i){t._plotMarks[e]=i}static createPlotMark(e,i){return t._plotMarks[e]?new t._plotMarks[e](i):null}static registerMark(e,i){t._marks[e]=i}static createMark(e,i,s){return t._marks[e]?new t._marks[e](i,e,s):null}static hasMark(e){return!!t._marks[e]}static registerComponent(e,i){t._components[e]=i}static createComponent(e,i,s,n){const r=t._components[e];return r?new r(i,s,n):null}static hasComponent(e){return!!t._components[e]}static registerGraphicComponent(e,i){t._graphicComponents[e]=i}static createGraphicComponent(e,i,s){const n=t._graphicComponents[e];return n?n(i,s):null}static registerTransform(e,i,s){t._transforms[e]=Object.assign(i,{type:e,isBuiltIn:!!s})}static getTransform(e){return t._transforms[e]}static unregisterRuntimeTransforms(){Object.keys(t._transforms).forEach((e=>{t._transforms[e]&&!t._transforms[e].isBuiltIn&&(t._transforms[e]=null)}))}static registerGrammar(e,i,s){t._grammars[e]={grammarClass:i,specKey:null!=s?s:e}}static createGrammar(e,i,s){var n;const r=null===(n=t._grammars[e])||void 0===n?void 0:n.grammarClass;return r?new r(i,s):null}static getGrammars(){return this._grammars}static getGlyph(e){return t._glyphs[e]}static createInteraction(e,i,s){const n=t._interactions[e];return n?new n(i,s):null}static hasInteraction(e){return!!t._interactions[e]}};EO._plotMarks={},EO._marks={},EO._components={},EO._graphicComponents={},EO._transforms={},EO._grammars={},EO._glyphs={},EO._animations={},EO._interactions={},EO._graphics={},EO.registerGlyph=(t,e,i,s,n)=>(EO._glyphs[t]=new CO(e,i,s,n),EO._glyphs[t]),EO.registerAnimationType=(t,e)=>{EO._animations[t]=e},EO.getAnimationType=t=>EO._animations[t],EO.registerInteraction=(t,e)=>{EO._interactions[t]=e},EO.registerGraphic=(t,e)=>{EO._graphics[t]=e},EO.getGraphicType=t=>EO._graphics[t],EO.createGraphic=(t,e)=>{const i=EO._graphics[t];return i?i(e):null};const PO=t=>!!FL[t];function BO(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=EO.getGraphicType(e)?EO.createGraphic(e,i):EO.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||lo.getInstance().error(`create ${e} graphic failed!`),n}const RO=t=>{t&&(t[qL]=null,t.release(),t.parent&&t.parent.removeChild(t))},LO=["fillOpacity"],OO=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const IO={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;Ta(e.width)||!Ta(e.x1)&&Ta(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):Ta(e.x1)||!Ta(e.width)&&Ta(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),Ta(e.height)||!Ta(e.y1)&&Ta(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):Ta(e.y1)||!Ta(e.height)&&Ta(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),Ta(e.length)||!Ta(e.z1)&&Ta(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):Ta(e.z1)||!Ta(e.length)&&Ta(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[FL.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType"],transform:(t,e,i)=>{var s,n;const r=null!==(s=i.limit)&&void 0!==s?s:1/0,a=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,o=Math.min(r,a),l=ba(i.text)&&!ma(i.text.text),h=l?i.text.text:i.text;t.maxLineWidth=o===1/0?i.maxLineWidth:o,!l&&!i.textType||"rich"!==i.text.type&&"rich"!==i.textType?t.text=h:t.textConfig=h},storedAttrs:"limitAttrs"}],[FL.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return Ta(e)&&Ta(i)&&Ta(s)&&Ta(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[FL.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const DO=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=Sa(t)?IO[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(LO.includes(r)?OO(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{LO.includes(t)?OO(n,t,e):n[t]=e[t]}));return n},FO=(t,e,i)=>!(!ma(t)||!ma(e))||!ma(t)&&!ma(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(Sa(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),jO=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],zO=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(jO);function HO(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?zO:jO,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>FO(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=NO(t.attrs);return i.points=e.slice(t.startIndex,ma(t.endIndex)?e.length:t.endIndex),i})):null}function NO(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let VO=class{constructor(t){this.data=null,this.states=[],this.diffState=DL.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!ma(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(fa(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));wO(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?DO(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[qL]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?DO(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===DL.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const t=this.mark.animate.getAnimationConfigs("state");0!==t.length&&(this.graphicItem.stateAnimateConfig=t[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(RO(this.graphicItem),this.graphicItem[qL]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(e,i,s){var n;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.data=i;const r=xO(s);return this.items=i.map((t=>({datum:t,key:r(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=e,this.key=this.mark.isCollectionMark()?e:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA,{groupKey:e,data:i,key:s},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=$a(yO(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===DL.unChange&&(this.diffState=DL.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==DL.enter&&this.diffState!==DL.update||!this.states.length||this.useStates(this.states),this.mark.markType===FL.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new Uh))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[IL.update],a=e[IL.enter],o=e[IL.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===DL.enter?(a&&wO(this,t,a,s,l),r&&wO(this,t,r,s,l)):this.diffState===DL.update?((n&&a||i)&&wO(this,t,a,s,l),r&&wO(this,t,r,s,l)):this.diffState===DL.exit&&o&&(i&&wO(this,t,a,s,l),wO(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}clearStates(t){const e=ga(t)?t:0!==this.mark.animate.getAnimationConfigs("state").length;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(ya(o)&&!Ya(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&Sa(t)&&!Ya(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=$a(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=$a(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(e,i){var s;if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this);const n=null===(s=this.mark.getSpec())||void 0===s?void 0:s.stateSort;n&&e.sort(n),this.states=e;const r=ga(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)qx(s,i,t)&&Fa(i,s)||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[FL.line,FL.area,FL.largeRects,FL.largeSymbols].includes(t)}(e)&&t&&t.length&&ma(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||MO(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[IL.connectNulls],u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(h=NO(h),e===FL.line||e===FL.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>MO(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return ma(r.x)&&(r.x=a),ma(r.y)&&(r.y=o),ma(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(ma(r.x1)&&(r.x1=l),ma(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===FL.area);if(p)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=HO(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=NO(e.items[0]);n.points=e.points,t.push(n)})),t}return s?HO(t,e,i):null}(u,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=TO(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=HO(u,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===FL.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===FL.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i;if(!Oa(t))if(this.mark.needAnimate()){const s=this.diffAttributes(t),n=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},r=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(s).forEach((t=>{n[t]=this.getGraphicAttribute(t),r[t]=s[t]})),this.setNextGraphicAttributes(s),this.setPrevGraphicAttributes(n),this.setFinalGraphicAttributes(r);const a=this.mark.animate.getElementAnimators(this).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),o=Object.assign({},a,r);this.graphicItem.setAttributes(o)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!ma(e=Ia(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return Ia(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!Fa(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!Fa(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(RO(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?ma(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):ma(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?Aa(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class GO{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),$a(t).map((t=>Sa(t)?this.view.getGrammarById(t):t)).filter((t=>!ma(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{va(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(Aa(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(Aa(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const WO=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class UO extends GO{constructor(t,e){super(t,e),this.type=UO.type,this._resetType=[],this.clearPrevElements=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},UO.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WO(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=$a(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):Sa(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):wa(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(Aa(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.clearPrevElements()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.clearPrevElements()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);(this._resetType.includes("view")&&!e||this._resetType.includes("self")&&e)&&this.clearPrevElements()}}UO.type="element-select",UO.defaultOptions={state:$L.selected,trigger:"click"};class YO extends GO{constructor(t,e){super(t,e),this.type=YO.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},YO.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=WO(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return Sa(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}clearPrevElements(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.clearPrevElements()}reset(t){if(!this._statedElements||!this._statedElements.length)return;const e=t&&this._marks&&this._marks.includes(t.mark);"view"!==this._resetType||e?"self"===this._resetType&&e&&this.clearPrevElements():this.clearPrevElements()}}function KO(t){if(t)return t.type===uE.Band?t.bandwidth():t.type===uE.Point?t.step():void 0}YO.type="element-highlight",YO.defaultOptions={highlightState:$L.highlight,blurState:$L.blur,trigger:"pointerover",triggerOff:"pointerout"};class XO{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{const n=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),r=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(n||r)&&s.elements.forEach((s=>{t&&t.includes(s)?r&&s.addState(e):n&&s.addState(i)}))}))}addStateOfElements(t,e){this._marks.forEach((i=>{const s=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);s&&i.elements.forEach((i=>{t&&t.includes(i)&&s&&i.addState(e)}))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)}))}))}}const $O=()=>{Xa(UO,XO),EO.registerInteraction(UO.type,UO)},qO=()=>{Xa(YO,XO),EO.registerInteraction(YO.type,YO)},ZO=(t,e)=>bO(t)?t.output():t&&ya(t)?fa(t.callback)?i=>t.callback(i,e):fa(t.value)?t.value(e):t:t,JO=(t,e)=>t?ya(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=ZO(n,e),i}),{}):t.map((t=>ZO(t,e))):t;let QO=-1;class tI extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++QO}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=$a(this.spec.dependency).map((t=>Sa(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=$a(t).map((t=>Sa(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return $a(t).filter((t=>!ma(t))).forEach((i=>{var s;ma(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return $a(t).filter((t=>!ma(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{va(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return ma(this.spec[e])||this.detach(mO(this.spec[e],this.view)),this.spec[e]=t,this.attach(mO(t,this.view)),this.commit(),this}}const eI=(t,e,i)=>{var s,n;if("callback"===t&&fa(e))return{references:[],value:{callback:e,dependency:[]}};if(!ma(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!ma(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!ma(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=mO(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},iI=(t,e)=>{const i=EO.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(fO(a,e))));const o=((t,e,i)=>{if(ma(e))return{value:e};if(Aa(e)){const s=e.map((e=>eI(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return eI(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},sI=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=iI(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},nI=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s1e8&&(cI=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+cI++}class uI{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:dI("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:lo.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const pI="_data-view-diff-rank";class gI{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:dI("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[pI]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[pI]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[pI]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?Va({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!ma(this._fields)&&ma(i)?(this.dataSet.registerTransform("fields",lI),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}const fI={csv:function(t){return(arguments.length>2?arguments[2]:void 0).type=oI.DSV,Zn(t)},dsv:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=oI.DSV;const i=nI(hI,e),{delimiter:s}=i;if(!Sa(s))throw new TypeError("Invalid delimiter: must be a string!");return qn(s).parse(t)},tsv:function(t){return(arguments.length>2?arguments[2]:void 0).type=oI.DSV,Jn(t)},json:function(t){if(!Sa(t))return $a(t);try{return $a(JSON.parse(t))}catch(t){return[]}}};class mI extends tI{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(ma(t))return t;if(fa(t))return t.call(null,e);if(t.signal){const i=t.signal;return Sa(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!fI[e.type])return $a(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return fI[e.type](t,i,new gI(new uI))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],ma(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?mO(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=mO(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=mO(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];$a(t.source).forEach((t=>{const i=bO(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(e,i){this.view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_EVALUATE_DATA);const s=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=e);const n=this.evaluateTransform(s,this._input,i),r=this._evaluateFilter(n,i);return this.setValues(r),this._isLoaded=!0,this.view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return ma(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return ma(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return ma(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=$a(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=sI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=sI(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat($a(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=$a(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const vI="window",yI="view",_I={trap:!1},bI="width",xI="height",SI="viewWidth",AI="viewHeight",kI="padding",MI="viewBox",wI="autoFit";function TI(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function CI(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,TI(t,e,n,s)}class EI{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return TI(this.nodes,e,0,this.compare),CI(this.nodes,e,null,this.compare)}return this.nodes.push(t),TI(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),TI(this.nodes,e,0,this.compare),CI(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,CI(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class PI{constructor(t){this.list=[],this.ids={},this.idFunc=t||Kx}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class BI{constructor(){this.grammars=[],this.logger=lo.getInstance(),this._curRank=0,this._committed=new PI((t=>t.uid)),this._heap=new EI(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>ma(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new PI((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const RI=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===FL.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class LI{constructor(e){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER)},this._view=e}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return Pp(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{mc.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(e,i){return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_STAGE_RESIZE),this.shouldResize(e,i)&&(this._width=e,this._height=i,this._stage&&this._stage.resize(e,i)),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),e&&(this._stage.render(),this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var e,i,s,n,r;this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=null!==(e=a.stage)&&void 0!==e?e:(l={width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,ticker:a.ticker,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents,ReactDOM:a.ReactDOM},new Lb(l));var l;(null===(i=a.options3d)||void 0===i?void 0:i.enable)&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),this._view.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);const h=null!==(s=a.layer)&&void 0!==s?s:o.defaultLayer;if(this._view.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new BS(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=ya(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new OS(o,t)}return{stage:o,layer:h}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function OI(t){return ma(t.offsetX)?ma(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function II(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return Ta(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),Ta(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&Ta(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&Ta(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}function DI(t,e,i,s,n){if(n===vI){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{II(t,OI(t),!1)}))}));const e=OI(t);II(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class FI extends tI{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?yO(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(Aa(t)&&Aa(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return wa(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}},NI=(t,e)=>e&&e.debounce?bo(t,e.debounce):e&&e.throttle?xo(t,e.throttle):t;class VI extends VO{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!ma(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(fa(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return wO(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[qL]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?DO(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(e,i){if(!this.graphicItem)return!1;this.mark.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_STATE,{states:e},this),this.states=e.slice();const s=ga(i)?i:0!==this.mark.animate.getAnimationConfigs("state").length;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,s),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_STATE,{states:e},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===DL.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==DL.enter&&this.diffState!==DL.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!ma(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.diffState===DL.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=DO(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{Fa(this.items[0].nextAttrs,e)||Fa(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=IO[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{Fa(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===FL.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return ZL.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&Fa(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),Fa(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),Fa(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)qx(e,s,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[qL]=null})),this.glyphGraphicItems=null),super.release()}}const GI=t=>t.markType===FL.glyph?new VI(t):new VO(t);function WI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(QL,i?t.slice().sort(i):t.slice()),{keys:eO,data:s};const n=xO(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class UI{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?WI(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}const YI=(t,e)=>{if(!t)return null;if(t.from){const i=t.from,s=Object.keys(i);s.forEach((t=>{ma(i[t])&&delete i[t]}));const n=MO(s,e.mark.markType)&&!va(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(t.to){const i=t.to,s=Object.keys(i);s.forEach((t=>{ma(i[t])&&delete i[t]}));const n=MO(s,e.mark.markType)&&!va(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:Object.assign({},i)})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const KI=(t,e,i,s,n)=>fa(i)?i(t.getDatum(),t,n):i;class XI extends qd{constructor(t,e,i,s,n){super(t,e,i,s,n),this._interpolator=null==n?void 0:n.interpolator,this._element=null==n?void 0:n.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class $I extends qd{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:yp,i=Object.keys(e).filter((t=>0!==e[t]));this.subAnimate.animate.preventAttrs(i);const s=Object.assign({},this.from),n=Object.assign({},this.to),r=[];Object.keys(n).forEach((t=>{i.includes(t)?(s[t]=n[t],this.from[t]=n[t]):ma(s[t])?s[t]=this.target.getComputedAttribute(t):r.push(t)})),this.target.animates.forEach((t=>{t!==this.subAnimate.animate&&t.preventAttrs(r)})),this._fromAttribute=s,this._toAttribute=n}onStart(){if(this._fromAttribute){const t={};Object.keys(this._fromAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._fromAttribute[e])})),this.target.setAttributes(t,!1,{type:sh.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}})}}onEnd(){if(this._toAttribute){const t={};Object.keys(this._toAttribute).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(t[e]=this._toAttribute[e])})),this.target.setAttributes(t,!1,{type:sh.ANIMATE_END})}}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1;const s=this.step.getLastProps();Object.keys(s).forEach((t=>{this.subAnimate.animate.validAttr(t)&&(i[t]=s[t])})),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}Jd.mode|=rh.SET_ATTR_IMMEDIATELY;let qI=0;const ZI=t=>!ma(t)&&(t.prototype instanceof qd||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class JI{constructor(t,e,i){this.id=qI++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}getEndAttributes(){return this.runnings.reduce(((t,e)=>Object.assign(t,e.getEndProps())),{})}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const s=i.animate();this.runnings.push(s),s.startAt(this.unit.initialDelay),s.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((i=>{this.animateTimeSlice(s,i,t,e)})),s.wait(this.unit.loopDelayAfter),s.loop(this.unit.loopCount-1),Ta(this.unit.totalTime)&&setTimeout((()=>{s&&s.stop("end")}),this.unit.totalTime),s.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==s)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,s){const n=e.delay,r=e.delayAfter,a=e.duration,o=e.effects;if(n>0&&t.wait(n),o.length<0)t.wait(a);else{const e=o.map(((t,e)=>{var n;const r=null!==(n=t.type?function(t,e,i,s){const n=fa(e.options)?e.options.call(null,t.getDatum(),t,s):e.options;if(!e.type||!EO.getAnimationType(e.type))return null;const r=EO.getAnimationType(e.type)(t,n,i);return YI(r,t)}(this.element,t,i,s):t.channel?function(t,e,i,s){const n=e.channel;let r=null;return Aa(n)?r=n.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):ya(n)&&(r=Object.keys(n).reduce(((e,i)=>{var r,a;const o=!ma(null===(r=n[i])||void 0===r?void 0:r.from),l=!ma(null===(a=n[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?KI(t,0,n[i].from,0,s):void 0,e.to[i]=l?KI(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),YI(r,t)}(this.element,t,0,s):void 0)&&void 0!==n?n:{},o=r.custom||(null==t?void 0:t.custom),l=(null==r?void 0:r.customParameters)||(null==t?void 0:t.customParameters);r.from&&Object.keys(r.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(r.from);const h=ZI(o);return ma(o)||ZI(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new $I(r.from,r.to,a,t.easing):void 0:new XI(r.from,r.to,a,t.easing,{interpolator:o,element:this.element,parameters:l})})).filter((t=>!ma(t)));1===e.length?t.play(e[0]):e.length>1&&t.play(new wu(a,e))}r>0&&t.wait(r)}}function QI(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(tD(i,t[i]))})),e}function tD(t,e){const i=[];let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return $a(e).forEach((e=>{var n;const r=function(t){var e,i,s,n,r,a,o,l,h,c,d,u;if(ma(t.timeSlices)){const h=t;return{startTime:null!==(e=h.startTime)&&void 0!==e?e:oO,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:uO,loop:null!==(s=h.loop)&&void 0!==s?s:dO,controlOptions:Va({},gO,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:lO,delay:null!==(a=h.delay)&&void 0!==a?a:hO,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:cO,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:pO,customParameters:h.customParameters,options:h.options}]}]}}const p=$a(t.timeSlices).filter((t=>t.effects&&$a(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:oO,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:uO,loop:null!==(d=t.loop)&&void 0!==d?d:dO,controlOptions:Va({},gO,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e,i;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:hO,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:cO,effects:$a(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:pO,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(n=r.id)&&void 0!==n?n:`${t}-${s}`,timeline:r,originConfig:e}),s+=1)})),i}function eD(t,e,i){return fa(t)?t.call(null,e.getDatum(),e,i):t}class iD{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!ma(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,s;return Math.max(t,null!==(s=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==s?s:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class sD{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=QI(null!=e?e:{})}getAnimationConfigs(t){var e;return this.isEnabled?(null!==(e=this.configs)&&void 0!==e?e:[]).filter((e=>e.state===t)):[]}updateConfig(t){this.configs=QI(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==DL.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new iD(n)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=tD(aO,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),s=this.mark.parameters(),n=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,s,!0))),[]);return new iD(n)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return ma(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const s=$a(t);let n=[];return e?n=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{n=n.concat(t)})),n.filter((t=>s.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=$a(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=$a(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var n;const r=[],a=e.filter((e=>{const n=!(e.isReserved&&e.diffState===DL.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=s||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return n&&a&&o&&l}));if(a.length){ma(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&a.sort(((e,s)=>t.timeline.sort(e.getDatum(),s.getDatum(),e,s,i)));const e={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(n=this.mark.group)&&void 0!==n?n:null,mark:this.mark,view:this.mark.view,elementCount:a.length,elementIndex:0};a.forEach(((s,n)=>{e.elementIndex=n;const o=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:e},i),l=this.getAnimationUnit(t.timeline,s,n,a.length,o);r.push(this.animateElement(t,l,s,e,o))}))}return r}animateElement(e,i,s,n,r){var a,o;const l=new JI(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===DL.exit&&(s.isReserved=!0);const h=0===this.timelineCount[e.id];this.timelineCount[e.id]+=1;const c=null!==(a=this.elementRecorder.get(s))&&void 0!==a?a:{prevState:e.state,count:{}};c.prevState=e.state,c.count[e.state]=(null!==(o=c.count[e.state])&&void 0!==o?o:0)+1,this.elementRecorder.set(s,c);const d=this.animators.get(e.state);d?d.push(l):this.animators.set(e.state,[l]),l.callback((()=>{this.handleAnimatorEnd(l)}));const u={mark:this.mark,animationState:e.state,animationConfig:e.originConfig};return h&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,u),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_START,u,s),l}getAnimationState(t){const e=yO(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=eD(t.startTime,e,n),o=eD(t.totalTime,e,n),l=eD(t.oneByOne,e,n),h=eD(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=eD(t.delay,e,n),l=eD(t.delayAfter,e,n),h=null!==(i=eD(t.duration,e,n))&&void 0!==i?i:o/s,d=$a(t.effects).map((t=>Object.assign({},t,{customParameters:eD(t.customParameters,e,n)})));r.push({effects:d,duration:h,delay:a,delayAfter:l}),c+=a+h+l}));const d=wa(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:wa(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(s-i-1),loopAnimateDuration:c,loopDuration:c+d*(s-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===DL.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===DL.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=e.element,n=e.animationOptions,r=n.state,a=r===aO,o=this.elementRecorder.get(s).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter((t=>t!==e))),0===this.animators.get(r).length&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=0===this.timelineCount[n.id],h=a?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),i&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():r===DL.exit&&0===o[DL.exit]&&this.clearElement(s));const c={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,c),this.mark.emit(t.VGRAMMAR_HOOK_EVENT.ELEMENT_ANIMATION_END,c,s)}}class nD extends tI{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new sD(this,{}),this.differ=new UI([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=Sa(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=Sa(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!ma(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===DL.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===YL.before)return this;const n=null===(s=this.view.renderer)||void 0===s?void 0:s.stage();this.init(n,i);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=e?e:tO,i);let a=(null==r?void 0:r.progressive)?e:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,i),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==r?void 0:r.progressive)&&(this.renderContext.parameters=i,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),i),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===FL.group)return;const e=WI(null!=t?t:tO,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this._groupEncodeResult=null,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>ma(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,ma(t)||(Sa(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return Sa(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(DL.update,t,e,i)}encodeState(t,e,i,s){if(t===DL.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(vO(n))this.detach(kO(n,this.view));else{const r=Sa(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(kO(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(kO(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(kO(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),Sa(e)?(this.spec.encode[t][e]=i,this.attach(kO(i,this.view))):vO(e)?(this.spec.encode[t]=e,this.attach(kO(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(kO(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=sI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=sI(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{ma(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{ma(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return ZL.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!ma(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==DL.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===XL.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!vO(n)&&Object.keys(n).forEach((t=>{SO(n[t])&&(e[t]=_O(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];vO(s)||Object.keys(s).forEach((t=>{AO(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[qL];if((null==s?void 0:s.mark)===this){const i=DI(this.view,t,s,0,yI);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new sD(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=_O(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(n=null===(s=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===s?void 0:s.indexOf(this))&&void 0!==n?n:0;if(this.markType!==FL.group){if(!this.graphicItem){const t=BO(this,FL.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||JL.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){if(this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==FL.group){if(ma(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),ma(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!ma(t.clipPath)){const e=Aa(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}))}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=xO(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>QL),a=xO(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>QL),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===DL.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(ma(e))n=this.elementMap.get(s),n&&(n.diffState=DL.exit);else if(ma(i)){n=this.elementMap.has(s)?this.elementMap.get(s):GI(this),n.diffState===DL.exit&&(n.diffState=DL.enter,this.animate.getElementAnimators(n,DL.exit).forEach((t=>t.stop("start")))),n.diffState=DL.enter;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),this.elementMap.set(s,n),c.push(n)}else if(n=this.elementMap.get(s),n){n.diffState=DL.update;const i=l?t:a(e[0]);n.updateData(i,e,r,this.view),c.push(n)}h.delete(n)}));const d=null!=t?t:tO;l||this.differ.setCurrentData(WI(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=TO(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return ma(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[IL.group],s);e.forEach((t=>{this.markType===FL.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,this._groupEncodeResult[t.groupKey])})):(null==a?void 0:a[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,r,a[t.groupKey])})):r&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r)})),t.encodeItems(t.items,i,this._isReentered,s),this.isCollectionMark()&&(null==a?void 0:a[t.groupKey])&&va(a[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=a[t.groupKey].defined})),delete a[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==a?void 0:a[t.groupKey]:null)})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:BO(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==FL.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const s=this.renderContext.progressive.currentIndex,n=xO(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>QL),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=GI(this);e.diffState=DL.enter,e.updateData(t,o,n,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=GI(this);i.diffState=DL.enter,i.updateData(t,[e],n,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==FL.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var e,i,s;if(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const e=this.renderContext.beforeTransformProgressive.output();return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE)}if(!(null===(i=this.renderContext)||void 0===i?void 0:i.progressive))return;const n=this.renderContext.parameters;this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=BO(this,FL.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=a):this.elements=this.elements.concat(a),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_STATE),this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const t=r.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_ENCODE);const o=null===(s=this._getTransformsAfterEncode())||void 0===s?void 0:s.filter((t=>!0===t.canProgressive));(null==o?void 0:o.length)&&this.evaluateTransform(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==DL.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:IO[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=DL.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&RO(this.graphicItem),this.detachAll(),super.release()}}let rD=class extends nD{constructor(t,e){super(t,FL.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===FL.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return IO.rect}evaluateJoin(t){if(!this.elements.length){const t=GI(this);t.updateData(QL,tO,(()=>""),this.view),this.elements=[t],this.elementMap.set(QL,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(ma(e.clip)||(i.clip=e.clip),ma(e.zIndex)||(i.zIndex=e.zIndex),!ma(e.clipPath)){const s=fa(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return ma(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return wO(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(e,i,s,n){const r=this.getChannelsFromConfig();if(i){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ELEMENT_ENCODE,{encoders:i,parameters:s},this);const a=n?null:this.evaluateGroupEncode(e,i[IL.group],s);e.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,r,a)})),t.encodeItems(t.items,i,this._isReentered,s)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),e,s),e.forEach((t=>{t.encodeGraphic()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,{encoders:i,parameters:s},this)}else e.forEach((t=>{t.initGraphicItem(r)}))}addGraphicItem(e,i,s){const n=null!=s?s:BO(this,this.markType,e);if(n)return this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n}),n}};function aD(t,e){if(Ta(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return Ta(t)?t*e:0}return 0}function oD(t,e){return Math.min(t<0?t+e:t-1,e)}function lD(t,e,i){let s=oD(t,i),n=oD(e,i);if(Ta(t)||Ta(e)?Ta(t)?Ta(e)||(s=oD(Math.max(0,n-1),i)):n=oD(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const hD=(t,e,i,s)=>{const n=function(t,e,i){var s,n,r,a;const o=null!==(s=t.gridTemplateRows)&&void 0!==s?s:[i],l=null!==(n=t.gridTemplateColumns)&&void 0!==n?n:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>aD(t,i))),u=l.map((t=>aD(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,s=f;return f+=i+h,s}));m.push(f);let v=0;const y=u.map(((t,e)=>{const i="auto"===l[e]?g:t,s=v;return v+=i+c,s}));return y.push(v),{rows:m,columns:y,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());e&&e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,s,n){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=lD(e,i,r),{start:h,end:c}=lD(s,n,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Xo).set(d,p,u,g)}(n,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},cD={[jL.axis]:0,[jL.legend]:1,[jL.slider]:2,[jL.player]:3,[jL.datazoom]:4},dD=t=>{var e,i,s;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(s=cD[t.componentType])&&void 0!==s?s:1/0},uD=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=Zx(r.maxChildWidth,n.width()),o=Zx(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=HI(e.padding),u=s.parseMarkBounds?s.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?n.y1+=t:n.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?n.x1+=t:n.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(n.x1+=Math.max(i.x1-u.x1,0)+r.left,n.x2-=Math.max(u.x2-i.x2,0)+r.right,n.y1+=Math.max(i.y1-u.y1,0)+r.top,n.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>n.x1-i.x1&&li.x2-n.x2&&hn.y1-i.y1&&ci.y2-n.y2&&ddD(t)-dD(e)));for(let t=0,e=m.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==FL.group)return;const n=t.layoutChildren,r=t.getSpec().layout,a=null!==(s=t.layoutBounds)&&void 0!==s?s:t.getBounds();if(a){if(fa(r))r.call(null,t,n,a,e);else if(fa(r.callback))r.callback.call(null,t,n,a,e);else if("relative"===r.display)if(r.updateViewSignals){const s=i.getViewBox();s&&a.intersect(s);const r=uD(t,n,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(SI,o),i.updateSignal(AI,l),i.updateSignal(kI,h)}else uD(t,n,a,e);else"grid"===r.display&&hD(t,n,a);pD(n,e,i)}}))};class gD extends nD{constructor(t,e,i){super(t,FL.glyph,i),this.glyphType=e,this.glyphMeta=EO.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!EO.getGraphicType(FL.glyph))return;const s=EO.createGraphic(FL.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(EO.getGraphicType(n[t])){const e=EO.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const fD=Symbol.for("key");class mD{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new UI(t,i);return n.setCallback(((t,e,i)=>{ma(e)?s.exit.push({prev:i[0]}):ma(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(WI(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==FL.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==FL.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=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}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!ma(e.morphElementKey)){const i=xO(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const s=function(t,e,i){const s={enter:[],exit:[],update:[]},n=new UI(t,i);return n.setCallback(((t,e,i)=>{ma(e)?s.exit.push({prev:i}):ma(i)?s.enter.push({next:e}):s.update.push({next:e,prev:i})})),n.setCurrentData(WI(e,i)),n.doDiff(),s}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const n=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};s.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,n)})),r+=1})),s.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),s=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:fD})),r=WI(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:fD}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==fD){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,s,n){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=yO(i.animation.delay,n,o,l),d=yO(i.animation.duration,n,o,l),u=yO(i.animation.oneByOne,n,o,l),p=yO(i.animation.splitPath,n,o,l),g=Ta(u)&&u>0?t=>wa(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)?op:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:lp)(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);sp(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?op:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:lp)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Qu(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>ep(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:sh.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 ip({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:su,null!==(l=i.easing)&&void 0!==l?l:nu))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:sh.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new np({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:su,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:nu))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):sp(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))}}class vD{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=Sa(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),ma(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),ma(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),ma(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),ma(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class yD extends vD{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===FL.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===FL.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{const s=t.mark;s.markType===FL.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===FL.group&&e.includesChild(s,!1)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class _D{constructor(e){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((t=>t.config!==e.animationConfig||t.mark!==e.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,{})},this._view=e,this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).resume)||void 0===i||i.call(e))})),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).enable)||void 0===i||i.call(e))})),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree((t=>{var e,i;t.animate&&(null===(i=(e=t.animate).disable)||void 0===i||i.call(e))})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&t.animate&&(null===(i=(e=t.animate).stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).enableAnimationState)||void 0===s||s.call(i,t))})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,s;e.animate&&(null===(s=(i=e.animate).disableAnimationState)||void 0===s||s.call(i,t))})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this.isEnabled?(this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this):this}animateAddition(t){const e=t.animate.animate();return e&&e.isAnimating()&&this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._animations=[],this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,this._onAnimationEnd),this._view=null}}class bD extends nD{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=BO(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?FL.richtext:FL.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}bD.markType=FL.text;const xD={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},SD={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},AD=Object.assign({},xD);AD.axis=Object.assign({},AD.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),AD.circleAxis=Object.assign({},AD.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),AD.grid=Object.assign({},AD.grid,{style:{stroke:"#404349"}}),AD.circleGrid=Object.assign({},AD.circleGrid,{style:{stroke:"#404349"}}),AD.rectLabel=Object.assign({},AD.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),AD.lineLabel=Object.assign({},AD.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),AD.symbolLabel=Object.assign({},AD.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),AD.title=Object.assign({},AD.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const kD={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:SD,components:AD},MD={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:SD,components:xD};let wD=class t{static registerTheme(e,i){e&&t._themes.set(e,i)}static unregisterTheme(e){t._themes.delete(e)}static getTheme(e){return t._themes.get(e)}static getDefaultTheme(){return t.getTheme("default")}};wD._themes=new Map,wD.registerTheme("default",MD),wD.registerTheme("dark",kD);class TD extends nD{constructor(t,e,i,s){super(t,FL.component,i),this._componentDatum={[QL]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(e,i,s){const n=null!=s?s:EO.createGraphicComponent(this.componentType,e,{mode:this.mode,skipDefault:this.spec.skipTheme});return n&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_ADD_VRENDER_MARK,{graphicItem:n}),this.graphicParent.appendChild(n),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_ADD_VRENDER_MARK,{graphicItem:n})),n}join(t){return super.join(t,QL)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[QL]+=1}evaluateJoin(t){return this.spec.key=QL,t?(t[QL]=this._componentDatum[QL],this._componentDatum=t):this._componentDatum={[QL]:this._componentDatum[QL]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class CD extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=bo((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const s=null===(i=t.target)||void 0===i?void 0:i[qL],n=DI(0,t,s,0,yI);this.emit(e,n,s)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=$a(t),i=[];return e.forEach((t=>{if(bO(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):PO(t)?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){Sa(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new FI(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new mI(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=EO.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=EO.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=Sa(e)?this.getMarkById(e):e;let n;switch(t){case FL.group:n=new rD(this,s);break;case FL.glyph:n=new gD(this,null==i?void 0:i.glyphType,s);break;case FL.component:n=EO.hasComponent(null==i?void 0:i.componentType)?EO.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new TD(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case FL.text:n=new bD(this,t,s);break;default:n=EO.hasMark(t)?EO.createMark(t,this,s):new nD(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(FL.group,t)}glyph(t,e){return this.mark(FL.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(FL.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(FL.component,t,{componentType:jL.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(FL.component,t,{componentType:jL.grid,mode:e})}legend(t){return this.mark(FL.component,t,{componentType:jL.legend})}slider(t){return this.mark(FL.component,t,{componentType:jL.slider})}label(t){return this.mark(FL.component,t,{componentType:jL.label})}datazoom(t){return this.mark(FL.component,t,{componentType:jL.datazoom})}player(t){return this.mark(FL.component,t,{componentType:jL.player})}title(t){return this.mark(FL.component,t,{componentType:jL.title})}scrollbar(t){return this.mark(FL.component,t,{componentType:jL.scrollbar})}customized(t,e){const i=EO.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=Sa(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&zI.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(RO(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(e){var i,s,n,r,a,o;if(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_PARSE_VIEW),this._spec=e,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++jI;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(e),e.theme?this.theme(e.theme):this.theme(wD.getDefaultTheme()),e.width&&this.width(e.width),e.height&&this.height(e.height),this.padding(null!==(s=null!==(i=e.padding)&&void 0!==i?i:this._options.padding)&&void 0!==s?s:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(bI,t.width),this.updateSignal(xI,t.height))}(null===(n=e.signals)||void 0===n?void 0:n.length)&&e.signals.forEach((t=>{this.signal().parse(t)})),(null===(r=e.data)||void 0===r?void 0:r.length)&&e.data.forEach((t=>{this.data(null).parse(t)})),(null===(a=e.coordinates)||void 0===a?void 0:a.length)&&e.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(o=e.scales)||void 0===o?void 0:o.length)&&e.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const l=EO.getGrammars();return Object.keys(l).forEach((t=>{const{specKey:i}=l[t];e[i]&&e[i].length&&e[i].forEach((e=>{this.customized(t,e)}))})),e.marks&&e.marks.length&&e.marks.forEach((t=>{this.parseMarkSpec(t)})),e.events&&e.events.length&&e.events.forEach((t=>{this.event(t)})),e.interactions&&e.interactions.length&&e.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===e.animation?this.animate.disable():this.animate.enable(),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=YL.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:bI,value:null!==(s=t[bI])&&void 0!==s?s:0},{id:xI,value:null!==(n=t[xI])&&void 0!==n?n:0},{id:kI,value:HI(null!==(a=null!==(r=t[kI])&&void 0!==r?r:e[kI])&&void 0!==a?a:null==i?void 0:i.padding)},{id:SI,update:{callback:(t,e)=>{const i=HI(e[kI]);return e[bI]-i.left-i.right},dependency:[bI,kI]}},{id:AI,update:{callback:(t,e)=>{const i=HI(e[kI]);return e[xI]-i.top-i.bottom},dependency:[xI,kI]}},{id:MI,update:{callback:(t,e)=>{const i=HI(e[kI]);return(t||new Xo).setValue(i.left,i.top,i.left+e[SI],i.top+e[AI])},dependency:[SI,AI,kI]}},{id:wI,value:null!==(o=t[wI])&&void 0!==o?o:e[wI]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===FL.glyph?{glyphType:t.glyphType}:t.type===FL.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;Sa(t)?this._theme=null!==(e=wD.getTheme(t))&&void 0!==e?e:wD.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(bI);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(xI);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(SI);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(AI);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(kI);if(arguments.length){const i=HI(t);return this.updateSignal(e,i),i}return HI(e.output())}autoFit(t){const e=this.getSignalById(wI);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(MI);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=YL.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===FL.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||pD;i&&(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&(this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_LAYOUT),i(this._layoutMarks,this._options,this),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{RI(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_MARK_RENDER_END),RI(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(e){this.emit(t.VGRAMMAR_HOOK_EVENT.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(e),this.handleRenderEnd()),this.emit(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=iO,morph:o=sO,morphAll:l=nO,animation:h={},enableExitAnimation:c=rO}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:pO,delay:null!==(i=h.delay)&&void 0!==i?i:hO,duration:null!==(s=h.duration)&&void 0!==s?s:lO,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:uO,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=YL.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=YL.reevaluate,this._dataflow.evaluate()),this._layoutState=YL.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,s)})),this._willMorphMarks=null,this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!zI.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,s=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&s||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return RI(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=function(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(bI,t)),e!==this.height()&&(s=!0,this.updateSignal(xI,e)),s&&(i?this.evaluate():this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:s,throttle:n,debounce:r,consume:a,target:o,dependency:l}=t,h=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yI;const i={},s=t.split(":");if(2===s.length){const[t,n]=s;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):PO(t)?(i.markType=t,i.source=e):i.source=t===vI?vI:e,i.type=n}else 1===s.length&&(i.type=t,i.source=e);return i}(e);if(!h)return;const{source:c,type:d}=h,u=ma((m=h).markId)?t=>t&&t.mark.id()===m.markId:ma(m.markName)?t=>t&&t.mark.name()===m.markName:ma(m.type)?t=>t&&t.mark.markType===m.type:()=>!0,p=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:Sa(o)?this.getSignalById(o):null,callback:s}]).filter((t=>t.signal||t.callback)),g=fO(l,this),f=NI(((t,e)=>{const s=c===yI&&function(t,e){const i=t.defaults,s=i.prevent,n=i.allow;return!1!==s&&!0!==n&&(!0===s||!1===n||(s?s[e]:!!n&&!n[e]))}(this._eventConfig,d)||a&&(void 0===t.cancelable||t.cancelable);c===vI&&(t=DI(0,t,e,0,vI));let n=!1;if((!i||i(t))&&(!u||u(e))&&p.length){const e=g.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});p.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),n=!0):i.callback?i.callback(t,e):(this.commit(i.signal),n=!0)}))}s&&t.preventDefault(),a&&t.stopPropagation(),n&&this.run()}),{throttle:n,debounce:r});var m;if(c===yI){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||ya(s)&&!s[i])}(this._eventConfig,yI,d))return this.addEventListener(d,f,_I),()=>{this.removeEventListener(d,f)}}else if(c===vI)return db.addEventListener(d,f),this._eventListeners.push({type:d,source:db,handler:f}),()=>{db.removeEventListener(d,f);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===db&&t.handler===f));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,s=`${e.type}-${t.type}-${i.type}`;let n;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[s]){const e=this.bindEvents(t);this._eventCache[s]=e}n||(n=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[s]&&(this._eventCache[s](),this._eventCache[s]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);Sa(e)?i.type=e:ya(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}interaction(t,e){const i=EO.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return ma(e)?Sa(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new LI(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new vD((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new yD((t=>t.id())),this._options.logger&&lo.setInstance(this._options.logger),this.logger=lo.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new BI,this.animate=new _D(this),this._morph=new mD,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{Aa(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[yI,vI]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:wD.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&db.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=YL.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==FL.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=db.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&db.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),EO.unregisterRuntimeTransforms(),lo.setInstance(null),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const ED=()=>{Jw(),Ww(),EO.registerGraphic(FL.path,km)},PD=()=>{Jw(),Xw(),EO.registerGraphic(FL.rect,lm)},BD=()=>{Jw(),Vw(),EO.registerGraphic(FL.rule,rm)},RD=()=>{Jw(),tT(),EO.registerGraphic(FL.symbol,im)},LD=()=>{Jw(),iT(),qw(),EO.registerGraphic(FL.text,qg)},OD=()=>{Jw(),Dw(),EO.registerGraphic(FL.glyph,cm)},ID=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!Ta(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return Ta(d)&&(m.from.min=l,m.to.min=d),Ta(u)&&(m.from.max=l,m.to.max=u),Ta(p)&&(m.from.q1=l,m.to.q1=p),Ta(g)&&(m.from.q3=l,m.to.q3=g),Ta(f)&&(m.from.median=l,m.to.median=f),m},DD=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!Ta(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return Ta(d)&&(m.to.min=l,m.from.min=d),Ta(u)&&(m.to.max=l,m.from.max=u),Ta(p)&&(m.to.q1=l,m.from.q1=p),Ta(g)&&(m.to.q3=l,m.from.q3=g),Ta(f)&&(m.to.median=l,m.from.median=f),m},FD=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&Ta(i.center))return i.center;let f,m,v,y,_;if(eS(e)){f=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");y=i,_=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");y=i,_=i+e}return Ta(f)?f:Ta(y)&&Ta(_)?(y+_)/2:Ta(m)&&Ta(v)?(m+v)/2:Ta(v)?v:Ta(m)?m:NaN},jD=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),y=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),_=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&eS(s.direction)?(Ta(y)?(Object.assign(u.box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),Ta(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(Ta(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),Ta(_)?(Object.assign(u.max,{x:p-_/2,x1:p+_/2}),Object.assign(u.min,{x:p-_/2,x1:p+_/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u},zD=ID(FD),HD=DD(FD);const ND=(t,e,i)=>{var s,n,r,a;if(Ta(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(eS(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return Ta(o)?o:Ta(c)&&Ta(d)?(c+d)/2:Ta(l)&&Ta(h)?(l+h)/2:Ta(h)?h:Ta(l)?l:NaN},VD=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),y=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),_=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&eS(s.direction)?(Ta(_)?Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}):Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}),Ta(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2}))):(Ta(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),Ta(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u},GD=ID(ND),WD=DD(ND);const UD=(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`},YD=(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`},KD=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?YD:UD,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},XD=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{ma(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},$D=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{ma(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},qD=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{ma(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class ZD extends TD{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=Sa(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=Sa(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return Sa(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const JD=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class QD extends ZD{constructor(t,e,i){super(t,jL.axis,e),this.spec.componentType=jL.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Va({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=EO.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=Sa(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=Sa(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=TO(n,e,i,s);const h=yO(this.spec.inside,s,e,i),c=yO(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(JD(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=yO(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case HL.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?Va({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):Va({},l,null!=i?i:{})})(u,o,l,p);case HL.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?Va({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):Va({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(ma(e)){const i=Sa(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?HL.circleAxis:HL.lineAxis,this._axisComponentType}}QD.componentType=jL.axis;let tF=class extends TD{constructor(t,e){super(t,jL.label,e),this.spec.componentType=jL.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=$a(this.spec.target).map((t=>Sa(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=$a(t).map((t=>Sa(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=$a(this.spec.target).map((t=>Sa(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=yO(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=yO(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case FL.line:case FL.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case FL.rect:case FL.rect3d:case FL.interval:g=p.rectLabel;break;case FL.symbol:case FL.circle:case FL.cell:g=p.symbolLabel;break;case FL.arc:case FL.arc3d:g=p.arcLabel;break;case FL.polygon:case FL.path:default:g=p.pointLabel}const f=null!==(o=u.data)&&void 0!==o?o:[],m=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};f&&f.length>0?f.forEach(((e,s)=>{if(t.elements[s]){const n=TO(i,e,t.elements[s],d);Va(e,m,n)}})):t.elements.forEach((e=>{if("willRelease"!==e.getGraphicItem().releaseStatus)if(t.isCollectionMark())e.getDatum().forEach((t=>{const s=TO(i,t,e,d);f.push(Va({},m,s))}));else{const t=TO(i,e.getDatum(),e,d),s=Va({},m,t);f.push(s)}}));const v=null===(c=t.graphicItem)||void 0===c?void 0:c.name;return Va({},g,{data:f,baseMarkGroupName:v,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{})})).filter((t=>!ma(t)));return Va({},o,{size:e,dataLabels:l})}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};tF.componentType=jL.label;const eF=()=>{EO.registerGraphicComponent(jL.label,(t=>new BC(t))),EO.registerComponent(jL.label,tF)};class iF extends ZD{constructor(t,e,i){super(t,jL.grid,e),this.spec.componentType=jL.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=Sa(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=Sa(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=Sa(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=Va({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=EO.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=TO(s,t,e,i);const d=yO(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=Sa(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case NL.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case NL.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=Sa(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=yO(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(JD(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===NL.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=yO(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case NL.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?Va({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):Va({},l,null!=i?i:{})})(u,l,c,p);case NL.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?Va({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):Va({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=NL.circleAxisGrid:this._gridComponentType=NL.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case HL.circleAxis:this._gridComponentType=NL.circleAxisGrid;break;case HL.lineAxis:default:this._gridComponentType=NL.lineAxisGrid}else if(this.spec.scale){const e=Sa(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?NL.lineAxisGrid:NL.circleAxisGrid:NL.lineAxisGrid}else this._gridComponentType=NL.lineAxisGrid;return this._gridComponentType}}iF.componentType=jL.grid;const sF=(t,e,i)=>e.filter((e=>t.callback(e,i))),nF=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!ma(n)){if(ma(t))return;t[n]=e}return e})),e;const r=s(e,i);return ma(n)||ma(e)?r:(e[n]=r,e)};function rF(t){return t.reduce(((t,e)=>t+e),0)}const aF={min:Ja,max:Za,average:function(t){return 0===t.length?0:rF(t)/t.length},sum:rF};function oF(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function lF(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 hF(t,e,i,s){return lF(t,e,i,"min",s)}function cF(t,e,i,s){return lF(t,e,i,"max",s)}function dF(t,e,i,s){return lF(t,e,i,"average",s)}function uF(t,e,i,s){return lF(t,e,i,"sum",s)}const pF=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=oF;if("min"===n?l=hF:"max"===n?l=cF:"average"===n?l=dF:"sum"===n&&(l=uF),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[]},gF="_mo_hide_";const fF=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;ma(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(gF)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(gF,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=ma(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(gF,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=ma(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},mF=()=>{EO.registerTransform("filter",{transform:sF,markPhase:"beforeJoin"},!0)},vF=()=>{EO.registerTransform("map",{transform:nF,markPhase:"beforeJoin"},!0)},yF=()=>{EO.registerTransform("sampling",{transform:pF,markPhase:"afterEncode"},!0)},_F=()=>{EO.registerTransform("markoverlap",{transform:fF,markPhase:"afterEncode"},!0)},bF=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},xF=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},SF=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&void 0!==s?s:{};return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=o.opacity)&&void 0!==n?n:1,fillOpacity:null!==(r=o.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=o.strokeOpacity)&&void 0!==a?a:1}}},AF=(t,e,i)=>{var s,n,r;return{from:{opacity:null!==(s=t.getGraphicAttribute("opacity",!0))&&void 0!==s?s:1,fillOpacity:null!==(n=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==n?n:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},kF=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;switch(null==e?void 0:e.direction){case"x":{const e=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.x,i=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.x1,a=null===(r=t.getFinalGraphicAttributes())||void 0===r?void 0:r.width;return{from:va(a)?{x:e+a/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:a}}}case"y":{const e=null===(a=t.getFinalGraphicAttributes())||void 0===a?void 0:a.y,i=null===(o=t.getFinalGraphicAttributes())||void 0===o?void 0:o.y1,s=null===(l=t.getFinalGraphicAttributes())||void 0===l?void 0:l.height;return{from:va(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=null===(h=t.getFinalGraphicAttributes())||void 0===h?void 0:h.x,i=null===(c=t.getFinalGraphicAttributes())||void 0===c?void 0:c.x1,s=null===(d=t.getFinalGraphicAttributes())||void 0===d?void 0:d.width,n=null===(u=t.getFinalGraphicAttributes())||void 0===u?void 0:u.y,r=null===(p=t.getFinalGraphicAttributes())||void 0===p?void 0:p.y1,a=null===(g=t.getFinalGraphicAttributes())||void 0===g?void 0:g.height,o={};return va(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),va(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},MF=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;switch(null==e?void 0:e.direction){case"x":{const e=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.x,i=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.x1,a=null===(r=t.getFinalGraphicAttributes())||void 0===r?void 0:r.width;return{to:va(a)?{x:e+a/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=null===(a=t.getFinalGraphicAttributes())||void 0===a?void 0:a.y,i=null===(o=t.getFinalGraphicAttributes())||void 0===o?void 0:o.y1,s=null===(l=t.getFinalGraphicAttributes())||void 0===l?void 0:l.height;return{to:va(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=null===(h=t.getFinalGraphicAttributes())||void 0===h?void 0:h.x,i=null===(c=t.getFinalGraphicAttributes())||void 0===c?void 0:c.y,s=null===(d=t.getFinalGraphicAttributes())||void 0===d?void 0:d.x1,n=null===(u=t.getFinalGraphicAttributes())||void 0===u?void 0:u.y1,r=null===(p=t.getFinalGraphicAttributes())||void 0===p?void 0:p.width,a=null===(g=t.getFinalGraphicAttributes())||void 0===g?void 0:g.height,o={};return va(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),va(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const wF=(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,a;const o=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.x,l=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.x1,h=null===(r=t.getFinalGraphicAttributes())||void 0===r?void 0:r.width;let c;return e&&"negative"===e.orient?wa(e.overall)?c=e.overall:i.group?(c=null!==(a=i.groupWidth)&&void 0!==a?a:i.group.getBounds().width(),i.groupWidth=c):c=i.width:c=wa(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:c,x1:ma(l)?void 0:c,width:ma(h)?void 0:0},to:{x:o,x1:l,width:h}}}(t,e,i):function(t,e,i){var s,n,r;const a=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.x,o=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.x1,l=null===(r=t.getFinalGraphicAttributes())||void 0===r?void 0:r.width;if(e&&"negative"===e.orient){const t=va(l)?Math.max(a,a+l):Math.max(a,o);return{from:{x:t,x1:ma(o)?void 0:t,width:ma(l)?void 0:0},to:{x:a,x1:o,width:l}}}const h=va(l)?Math.min(a,a+l):Math.min(a,o);return{from:{x:h,x1:ma(o)?void 0:h,width:ma(l)?void 0:0},to:{x:a,x1:o,width:l}}}(t,e)};const TF=(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=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.x1,o=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.width;let l;return e&&"negative"===e.orient?wa(e.overall)?l=e.overall:i.group?(l=null!==(r=i.groupWidth)&&void 0!==r?r:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=wa(null==e?void 0:e.overall)?e.overall:0,{to:{x:l,x1:ma(a)?void 0:l,width:ma(o)?void 0:0}}}(t,e,i):function(t,e,i){var s,n,r;const a=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.x,o=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.x1,l=null===(r=t.getFinalGraphicAttributes())||void 0===r?void 0:r.width;if(e&&"negative"===e.orient){const t=va(l)?Math.max(a,a+l):Math.max(a,o);return{to:{x:t,x1:ma(o)?void 0:t,width:ma(l)?void 0:0}}}const h=va(l)?Math.min(a,a+l):Math.min(a,o);return{to:{x:h,x1:ma(o)?void 0:h,width:ma(l)?void 0:0}}}(t,e)};const CF=(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,a;const o=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.y,l=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.y1,h=null===(r=t.getFinalGraphicAttributes())||void 0===r?void 0:r.height;let c;return e&&"negative"===e.orient?wa(e.overall)?c=e.overall:i.group?(c=null!==(a=i.groupHeight)&&void 0!==a?a:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=wa(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:ma(l)?void 0:c,height:ma(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){var s,n,r;const a=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.y,o=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.y1,l=null===(r=t.getFinalGraphicAttributes())||void 0===r?void 0:r.height;if(e&&"negative"===e.orient){const t=va(l)?Math.max(a,a+l):Math.max(a,o);return{from:{y:t,y1:ma(o)?void 0:t,height:ma(l)?void 0:0},to:{y:a,y1:o,height:l}}}const h=va(l)?Math.min(a,a+l):Math.min(a,o);return{from:{y:h,y1:ma(o)?void 0:h,height:ma(l)?void 0:0},to:{y:a,y1:o,height:l}}}(t,e)};const EF=(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=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.y1,o=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.height;let l;return e&&"negative"===e.orient?wa(e.overall)?l=e.overall:i.group?(l=null!==(r=i.groupHeight)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=l):l=i.height:l=wa(null==e?void 0:e.overall)?e.overall:0,{to:{y:l,y1:ma(a)?void 0:l,height:ma(o)?void 0:0}}}(t,e,i):function(t,e,i){var s,n,r;const a=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.y,o=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.y1,l=null===(r=t.getFinalGraphicAttributes())||void 0===r?void 0:r.height;if(e&&"negative"===e.orient){const t=va(l)?Math.max(a,a+l):Math.max(a,o);return{to:{y:t,y1:ma(o)?void 0:t,height:ma(l)?void 0:0}}}const h=va(l)?Math.min(a,a+l):Math.min(a,o);return{to:{y:h,y1:ma(o)?void 0:h,height:ma(l)?void 0:0}}}(t,e)},PF=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalGraphicAttributes();if(e&&"anticlockwise"===e.orient){const t=wa(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=wa(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalGraphicAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},BF=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=wa(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=wa(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalGraphicAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},RF=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalGraphicAttributes(),n=wa(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalGraphicAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},LF=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=wa(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalGraphicAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},OF=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(Ta(e.center.x)&&(n.x=e.center.x),Ta(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((()=>Object.assign(n)))},IF=(t,e,i)=>({from:{points:OF(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),DF=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:OF(t,e)}}),FF=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),jF=(t,e,i)=>({from:{points:FF(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),zF=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:FF(t,e,i)}}),HF=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}})),NF=(t,e,i)=>({from:{points:HF(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),VF=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:HF(t,e,i)}}),GF=(t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:d=[]}=null!=e?e:{};let u=0,p=0;"negative"===l&&(i.group?(u=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),p=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=u,i.groupHeight=p):(u=i.width,p=i.height)),u+=o,p+=o;const g=fa(c)?c.call(null,t.getDatum(),t,i):c,f=g&&Ta(g.x)?g.x:u,m=g&&Ta(g.y)?g.y:p,v=d.includes("x")?t.getGraphicAttribute("x"):null===(r=t.getFinalGraphicAttributes())||void 0===r?void 0:r.x,y=d.includes("y")?t.getGraphicAttribute("y"):null===(a=t.getFinalGraphicAttributes())||void 0===a?void 0:a.y;switch(h){case"x":return{from:{x:f},to:{x:v}};case"y":return{from:{y:m},to:{y:y}};default:return{from:{x:f,y:m},to:{x:v,y:y}}}},WF=(t,e,i)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{},h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(n=null==h?void 0:h.height())&&void 0!==n?n:i.height,u=("negative"===a?c:0)+r,p=("negative"===a?d:0)+r,g=fa(l)?l.call(null,t.getDatum(),t,i):l,f=g&&Ta(g.x)?g.x:u,m=g&&Ta(g.y)?g.y:p;switch(o){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:m}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:f,y:m}}}},UF=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=null==o?void 0:o.scaleX)&&void 0!==r?r:1,scaleY:null!==(a=null==o?void 0:o.scaleY)&&void 0!==a?a:1}}}},YF=(t,e,i)=>{var s,n,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(s=t.getGraphicAttribute("scaleX",!0))&&void 0!==s?s:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(n=t.getGraphicAttribute("scaleY",!0))&&void 0!==n?n:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},KF={symbol:["_mo_hide_","visible"]},XF=(t,e,i)=>{const s=Object.assign({},t.getPrevGraphicAttributes()),n=Object.assign({},t.getNextGraphicAttributes());let r;e&&$a(e.excludeChannels).forEach((t=>{delete s[t],delete n[t]})),t.mark&&t.mark.markType&&(r=KF[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{qx(t,s,n)&&(delete s[t],delete n[t])}));const a=t.getFinalGraphicAttributes();return Object.keys(s).forEach((t=>{ma(n[t])&&(ma(a[t])||Ya(s[t],a[t])?delete s[t]:n[t]=a[t])})),{from:s,to:n}},$F=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=uo(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:Ta(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},qF=(t,e,i)=>{var s;const n=null!==(s=t.getGraphicAttribute("angle",!0))&&void 0!==s?s:0;let r=0;return r=uo(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:Ta(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},ZF=()=>{EO.registerAnimationType("clipIn",bF)},JF=()=>{EO.registerAnimationType("clipOut",xF)},QF=()=>{EO.registerAnimationType("fadeIn",SF)},tj=()=>{EO.registerAnimationType("fadeOut",AF)},ej=()=>{EO.registerAnimationType("growCenterIn",kF)},ij=()=>{EO.registerAnimationType("growCenterOut",MF)},sj=()=>{EO.registerAnimationType("growHeightIn",CF)},nj=()=>{EO.registerAnimationType("growHeightOut",EF)},rj=()=>{EO.registerAnimationType("growWidthIn",wF)},aj=()=>{EO.registerAnimationType("growWidthOut",TF)},oj=()=>{EO.registerAnimationType("growPointsIn",IF)},lj=()=>{EO.registerAnimationType("growPointsOut",DF)},hj=()=>{EO.registerAnimationType("growPointsXIn",jF)},cj=()=>{EO.registerAnimationType("growPointsXOut",zF)},dj=()=>{EO.registerAnimationType("growPointsYIn",NF)},uj=()=>{EO.registerAnimationType("growPointsYOut",VF)},pj=()=>{EO.registerAnimationType("growAngleIn",PF)},gj=()=>{EO.registerAnimationType("growAngleOut",BF)},fj=()=>{EO.registerAnimationType("growRadiusIn",RF)},mj=()=>{EO.registerAnimationType("growRadiusOut",LF)},vj=()=>{EO.registerAnimationType("moveIn",GF)},yj=()=>{EO.registerAnimationType("moveOut",WF)},_j=()=>{EO.registerAnimationType("scaleIn",UF)},bj=()=>{EO.registerAnimationType("scaleOut",YF)},xj=()=>{EO.registerAnimationType("rotateIn",$F)},Sj=()=>{EO.registerAnimationType("rotateOut",qF)},Aj=()=>{EO.registerAnimationType("update",XF)};class kj extends nD{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=vO(e)?null:Object.keys(e).reduce(((t,s)=>(SO(e[s])&&(t[s]=_O(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=TO(e,t,i,n);if(ma(r.size)){const t=s.x?KO(s.x):void 0,e=s.y?KO(s.y):void 0;ma(t)&&ma(e)?r.size=10:ma(t)?r.size=e:ma(e)&&(r.size=t),r.size=[t,e]}return ma(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(wa(i.padding)&&i.padding>0)t.size=Aa(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(Aa(i.padding)&&2===i.padding.length){const e=Aa(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(IO.symbol)}release(){super.release(),this._encoders=null}}kj.markType=FL.cell;const Mj=["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 wj,Tj,Cj;t.ChartEvent=void 0,(wj=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",wj.rendered="rendered",wj.renderFinished="renderFinished",wj.animationFinished="animationFinished",wj.regionSeriesDataFilterOver="regionSeriesDataFilterOver",wj.afterInitData="afterInitData",wj.afterInitEvent="afterInitEvent",wj.afterInitMark="afterInitMark",wj.rawDataUpdate="rawDataUpdate",wj.viewDataFilterOver="viewDataFilterOver",wj.viewDataUpdate="viewDataUpdate",wj.viewDataStatisticsUpdate="viewDataStatisticsUpdate",wj.markDeltaYUpdate="markDeltaYUpdate",wj.viewDataLabelUpdate="viewDataLabelUpdate",wj.scaleDomainUpdate="scaleDomainUpdate",wj.scaleUpdate="scaleUpdate",wj.dataZoomChange="dataZoomChange",wj.drill="drill",wj.layoutStart="layoutStart",wj.layoutEnd="layoutEnd",wj.layoutRectUpdate="layoutRectUpdate",wj.playerPlay="playerPlay",wj.playerPause="playerPause",wj.playerEnd="playerEnd",wj.playerChange="playerChange",wj.playerForward="playerForward",wj.playerBackward="playerBackward",wj.scrollBarChange="scrollBarChange",wj.brushStart="brushStart",wj.brushChange="brushChange",wj.brushEnd="brushEnd",wj.brushClear="brushClear",wj.legendSelectedDataChange="legendSelectedDataChange",wj.legendFilter="legendFilter",wj.legendItemClick="legendItemClick",wj.legendItemHover="legendItemHover",wj.legendItemUnHover="legendItemUnHover",wj.tooltipShow="tooltipShow",wj.tooltipHide="tooltipHide",wj.tooltipRelease="tooltipRelease",wj.afterResize="afterResize",wj.afterRender="afterRender",wj.afterLayout="afterLayout",t.Event_Source_Type=void 0,(Tj=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",Tj.window="window",Tj.canvas="canvas",t.Event_Bubble_Level=void 0,(Cj=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",Cj.chart="chart",Cj.model="model",Cj.mark="mark";const Ej=`${gL}_waterfall_default_seriesField`,Pj=`${gL}_CORRELATION_X`,Bj=`${gL}_CORRELATION_Y`,Rj=`${gL}_CORRELATION_SIZE`,Lj=`${gL}_MEASURE_CANVAS_ID`,Oj=`${gL}_DEFAULT_DATA_INDEX`,Ij=`${gL}_DEFAULT_DATA_KEY`,Dj=`${gL}_DEFAULT_DATA_SERIES_FIELD`,Fj=`${gL}_DEFAULT_SERIES_STYLE_NAME`;var jj;t.AttributeLevel=void 0,(jj=t.AttributeLevel||(t.AttributeLevel={}))[jj.Default=0]="Default",jj[jj.Theme=1]="Theme",jj[jj.Chart=2]="Chart",jj[jj.Base_Series=3]="Base_Series",jj[jj.Series=4]="Series",jj[jj.Mark=5]="Mark",jj[jj.User_Chart=6]="User_Chart",jj[jj.User_Series=7]="User_Series",jj[jj.User_Mark=8]="User_Mark",jj[jj.Built_In=99]="Built_In";const zj=`${gL}_STACK_KEY`,Hj=`${gL}_STACK_START`,Nj=`${gL}_STACK_END`,Vj=`${gL}_STACK_START_PERCENT`,Gj=`${gL}_STACK_END_PERCENT`,Wj=`${gL}_STACK_START_OffsetSilhouette`,Uj=`${gL}_STACK_END_OffsetSilhouette`,Yj=`${gL}_STACK_TOTAL`,Kj=`${gL}_STACK_TOTAL_PERCENT`,Xj=`${gL}_STACK_TOTAL_TOP`,$j=`${gL}_SEGMENT_START`,qj=`${gL}_SEGMENT_END`;var Zj,Jj;t.LayoutZIndex=void 0,(Zj=t.LayoutZIndex||(t.LayoutZIndex={}))[Zj.Axis_Grid=50]="Axis_Grid",Zj[Zj.CrossHair_Grid=100]="CrossHair_Grid",Zj[Zj.Region=450]="Region",Zj[Zj.Mark=300]="Mark",Zj[Zj.Node=400]="Node",Zj[Zj.Axis=100]="Axis",Zj[Zj.MarkLine=500]="MarkLine",Zj[Zj.MarkArea=100]="MarkArea",Zj[Zj.MarkPoint=500]="MarkPoint",Zj[Zj.DataZoom=500]="DataZoom",Zj[Zj.ScrollBar=500]="ScrollBar",Zj[Zj.Player=500]="Player",Zj[Zj.Legend=500]="Legend",Zj[Zj.CrossHair=500]="CrossHair",Zj[Zj.Indicator=500]="Indicator",Zj[Zj.Title=500]="Title",Zj[Zj.Label=500]="Label",Zj[Zj.Brush=500]="Brush",Zj[Zj.CustomMark=500]="CustomMark",Zj[Zj.Interaction=700]="Interaction",t.LayoutLevel=void 0,(Jj=t.LayoutLevel||(t.LayoutLevel={}))[Jj.Indicator=10]="Indicator",Jj[Jj.Region=20]="Region",Jj[Jj.Axis=30]="Axis",Jj[Jj.DataZoom=40]="DataZoom",Jj[Jj.Player=40]="Player",Jj[Jj.ScrollBar=40]="ScrollBar",Jj[Jj.Legend=50]="Legend",Jj[Jj.Title=70]="Title",Jj[Jj.CustomMark=70]="CustomMark";const Qj=["linear","radial","conical"],tz={x0:0,y0:0,x1:1,y1:1},ez={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},iz={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},sz={linear:tz,radial:ez,conical:iz},nz={label:{name:"label",type:"text"}},rz=`${gL}_rect_x`,az=`${gL}_rect_x1`,oz=`${gL}_rect_y`,lz=`${gL}_rect_y1`,hz=Object.assign(Object.assign({},nz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),cz=Object.assign(Object.assign({},nz),{bar3d:{name:"bar3d",type:"rect3d"}}),dz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},uz=Object.assign(Object.assign({},nz),dz),pz=Object.assign(Object.assign({},nz),{point:{name:"point",type:"symbol"}}),gz=Object.assign(Object.assign(Object.assign({},nz),dz),{area:{name:"area",type:"area"}}),fz=Object.assign(Object.assign(Object.assign({},nz),dz),{area:{name:"area",type:"area"}}),mz=Object.assign(Object.assign({},nz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),vz=Object.assign(Object.assign({},nz),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),yz=Object.assign(Object.assign({},nz),{rose:{name:"rose",type:"arc"}}),_z=Object.assign(Object.assign({},nz),{area:{name:"area",type:"path"}}),bz=Object.assign(Object.assign({},nz),{group:{name:"group",type:"group"}}),xz=Object.assign(Object.assign({},bz),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),Sz=Object.assign(Object.assign({},nz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),Az=Object.assign(Object.assign({},nz),{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"}}),kz=Object.assign(Object.assign({},nz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),Mz=Object.assign(Object.assign({},nz),{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"}}),wz=Object.assign(Object.assign({},nz),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),Tz=Object.assign(Object.assign({},nz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),Cz=Object.assign(Object.assign({},hz),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),Ez=Object.assign(Object.assign({},nz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),Pz=Object.assign(Object.assign({},nz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),Bz=Object.assign(Object.assign({},nz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),Rz=Object.assign(Object.assign({},bz),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),Lz=Object.assign(Object.assign({},nz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),Oz=Object.assign(Object.assign({},nz),{sunburst:{name:"sunburst",type:"arc"}}),Iz=Object.assign(Object.assign({},hz),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),Dz=Object.assign(Object.assign({},cz),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),Fz=Object.assign(Object.assign({},nz),{circlePacking:{name:"circlePacking",type:"arc"}}),jz=Object.assign(Object.assign({},nz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),zz=Object.assign(Object.assign({},nz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),Hz=Object.assign({},gz),Nz=Object.assign(Object.assign({},nz),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),Vz=Object.assign(Object.assign({},nz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var Gz;!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(Gz||(Gz={}));const Wz={[uL.bar]:hz,[uL.bar3d]:cz,[uL.line]:uz,[uL.scatter]:pz,[uL.area]:gz,[uL.radar]:fz,[uL.pie]:mz,[uL.pie3d]:vz,[uL.rose]:yz,[uL.geo]:nz,[uL.map]:_z,[uL.circularProgress]:xz,[uL.link]:Sz,[uL.dot]:Az,[uL.wordCloud]:kz,[uL.wordCloud3d]:kz,[uL.funnel]:Mz,[uL.funnel3d]:wz,[uL.linearProgress]:Tz,[uL.waterfall]:Cz,[uL.boxPlot]:Ez,[uL.treemap]:Pz,[uL.sankey]:Bz,[uL.gauge]:Rz,[uL.gaugePointer]:Lz,[uL.sunburst]:Oz,[uL.rangeColumn]:Iz,[uL.rangeColumn3d]:Dz,[uL.circlePacking]:Fz,[uL.heatmap]:jz,[uL.correlation]:zz,[uL.rangeArea]:Hz,[uL.liquid]:Nz,[uL.venn]:Vz};function Uz(t){var e,i;const{type:s}=t;return s===uL.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const Yz={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},Kz={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function Xz(t,e){var i;if(!t)return[];const s=eH(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?Qz(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>Jz(i)?qz(t,i,e):i)).filter(p)}))):i.map((i=>Jz(i)?qz(t,i,e):i)).filter(p):[]}return[]}function $z(t,e){var i,s;return Qz(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 qz(t,e,i){var s;const n=eH(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=Yz[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=Kz[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)||!y(r))return r;let o=new Vt(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ot(t,i,s),a=Lt(n,r,e.l),l=new Vt(`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 Zz=(t,e,i)=>{if(e&&Jz(t)){const s=qz(e,t,i);if(s)return s}return t};function Jz(t){return t&&"palette"===t.type&&!!t.key}function Qz(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function tH(t){return _(t)?{dataScheme:t}:t}function eH(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=Uz(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 iH extends FR{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(!Qz(this._range))return void super.range(this._range);const t=$z(this._range,this._domain);super.range(t)}}const sH={linear:aL,band:zR,point:class extends zR{constructor(t){super(!1),this.type=gR.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:FR,threshold:dL,colorOrdinal:iH};function nH(t){const e=sH[t];return e?new e:null}function rH(t,e){if(!e)return t;const i=e.range(),s=Math.min(i[0],i[i.length-1]),n=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(s,t),n)}function aH(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function oH(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function lH(t){return!!y(t)&&(!!t.endsWith("%")&&Hx(t.substring(0,t.length-1)))}function hH(t,e,i,s=0){var n,r;return S(t)?t:lH(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 cH(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]=hH(t[s],e.size,i)}))})),o}function dH(t){let e={};return _(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||lH(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function uH(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const pH=(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},gH=[{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"]}],fH={default:{dataScheme:gH,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)"}}},mH="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",vH={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:{transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},funnel3d:{transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:"#707070",textBaseline:"middle"}}},linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:{pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:mH,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:mH,fill:"#ddd"}}},treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:LL,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},yH={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}}},_H=Object.assign(Object.assign({},yH),{label:{space:0}}),bH={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}}}}},xH="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;",SH={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:xH,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:xH,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},AH={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}},kH={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},MH={horizontal:Object.assign(Object.assign({},AH),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:kH}),vertical:Object.assign(Object.assign({},AH),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:kH})},wH={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},TH={horizontal:Object.assign(Object.assign({},AH),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:wH}),vertical:Object.assign(Object.assign({},AH),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:wH})},CH={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"}}}}},EH={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},PH={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};function BH(t,e){return t&&e.key in t?t[e.key]:e.default}function RH(t){return t&&"token"===t.type&&!!t.key}const LH={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%"},OH={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:fH,token:LH,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},series:vH,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:MH,sizeLegend:TH,axis:{domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:yH,axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},axisZ:_H,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:EH,markArea:CH,markPoint:PH,polarMarkLine:EH,polarMarkArea:CH,polarMarkPoint:PH,geoMarkPoint:PH,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:SH,crosshair:bH,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:{type:"token",key:"l1FontSize"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:{type:"token",key:"l2FontSize"},fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},IH={name:"dark",colorScheme:{default:{dataScheme:gH,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},DH=(t,e)=>t===e||!d(t)&&!d(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>DH(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>DH(t[i],e[i])))),FH=(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]={}),FH(t[s],e.slice(1),i))};function jH(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"];const i=t;let s;if(!p(i)||"object"!=typeof i)return i;if(i instanceof Mr||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(i))return i;const n=_(i),r=i.length;s=n?new Array(r):"object"==typeof i?{}:c(i)||S(i)||y(i)?i:x(i)?new Date(+i):void 0;const a=n?void 0:Object.keys(Object(i));let o=-1;if(s)for(;++o<(a||i).length;){const t=a?a[o]:o,n=i[t];(null==e?void 0:e.includes(t.toString()))?s[t]=n:s[t]=jH(n,e)}return s}function zH(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),n=[];for(const t in s)n.push(t);let{length:r}=n,a=-1;for(;r--;){const r=n[++a];p(s[r])&&"object"==typeof s[r]&&!_(t[r])?HH(t,e,r,i):NH(t,r,s[r])}}}}function HH(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=t[i],r=e[i];let a=e[i],o=!0;if(_(r)){if(s)a=[];else if(_(n))a=n;else if(b(n)){a=new Array(n.length);let t=-1;const e=n.length;for(;++t{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?VH({},t[n][e.index],i):i):t[n]=s?VH({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?VH({},t[n][r],i):i)}else t.id===e&&(t[n]=s?VH({},t[n],i):i)}))}function WH(t,...e){return VH(UH(t),...e.map(UH))}function UH(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=tH(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(Wz).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=YH(a,e,n,r),t}),{})),Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series,a)})}function YH(t,e,i,s){if(!Wz[e])return t;const n={};return Object.values(Wz[e]).forEach((({type:e,name:r})=>{n[r]=VH({},null==i?void 0:i[V(e)[0]],null==s?void 0:s[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),n)}const KH=["animationThreshold","colorScheme","name","padding"];function XH(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];KH.includes(r)?n[r]=a:m(a)?Jz(a)?n[r]=Zz(a,e,s):RH(a)?n[r]=BH(i,a):n[r]=XH(a,e,i,s):n[r]=a})),n}const $H={[OH.name]:OH},qH=OH.name,ZH=new Map(Object.keys($H).map((t=>[t,$H[t]]))),JH=new Map(Object.keys($H).map((t=>[t,XH($H[t])]))),QH=new Map(Object.keys($H).map((t=>[t,t===qH]))),tN=(t,e)=>{if(!t)return;const i=nN(e);ZH.set(t,i),JH.set(t,XH(i)),QH.set(t,!0)},eN=(t=qH,e=!1)=>(QH.has(t)&&!QH.get(t)&&tN(t,ZH.get(t)),e?JH.get(t):ZH.get(t)),iN=t=>ZH.delete(t)&&JH.delete(t)&&QH.delete(t),sN=t=>!!y(t)&&ZH.has(t),nN=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:qH;return WH({},eN(i),t)};class rN{static registerInstance(t){rN.instances.set(t.id,t)}static unregisterInstance(t){rN.instances.delete(t.id)}static getInstance(t){return rN.instances.get(t)}static instanceExist(t){return rN.instances.has(t)}static forEach(t,e=[],i){const s=V(e);return rN.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}rN.instances=new Map;class aN{static registerTheme(t,e){tN(t,e)}static getTheme(t,e=!1){return eN(t,e)}static removeTheme(t){return iN(t)}static themeExist(t){return sN(t)}static getDefaultTheme(){return aN.themes.get(qH)}static setCurrentTheme(t){aN.themeExist(t)&&(aN._currentThemeName=t,rN.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return aN.getTheme(aN._currentThemeName,t)}static getCurrentThemeName(){return aN._currentThemeName}}function oN(t,e){return y(t)?aN.themeExist(t)?aN.getTheme(t,e):{}:g(t)?t:{}}function lN(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]=lN(t[s],e)}return i}return _(t)?t.map((t=>lN(t,e))):t}function hN(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]=hN(t[s],e)}return i}return _(t)?t.map((t=>hN(t,e))):t}aN.themes=ZH,aN._currentThemeName=qH;function cN(t,e){for(let i=0;it.key===e))}function uN(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 pN(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{nodes:{}},yN(t,a,n[o],l,e,r))})),s?gN(n):n}function gN(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))):gN(t[e].nodes);return t}function fN(t,e){if("values"in t&&t.values.length){const i=rR(t.values,e),s=nR(t.values,Gj);t.values.forEach((t=>{t[Yj]=i,t[Kj]=s,delete t[Xj]}));const n=t.values.reduce(((t,e)=>e[Nj]>t[Nj]?e:t));n[Xj]=!0}else for(const i in t.nodes)fN(t.nodes[i],e)}function mN(t){if(!t.values.length)return;const e=t.values[t.values.length-1][Nj]/2;for(let i=0;i0){let s=0,n=0,r=1,a=0;const o=t.values.length;for(let i=0;i=0?(r[Hj]=s,s+=r[Nj],r[Nj]=s):(r[Hj]=n,n+=r[Nj],r[Nj]=n),r[zj]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[Vj]=0===h?0:Math.min(1,l[Hj]/h)*r,l[Gj]=0===h?0:Math.min(1,l[Nj]/h)*r}}for(const s in t.nodes)vN(t.nodes[s],e,i)}function yN(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[Nj]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const o in e.nodes){const l=a?`${a}_${o}`:o;!i.nodes[o]&&(i.nodes[o]={values:[],series:[],nodes:{},sortDatums:[],key:l}),yN(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const _N=(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]=xN(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function SN(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>kN(t.style(e,i,s,n)):E(t.style)||(e.style=kN(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>kN(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=kN(t.state[e]))})),e.state=i}return e}function AN(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>kN(t[i](e,s,n,r)):E(t[i])||(e[i]=kN(t[i]))})),e}function kN(t){return(null==t?void 0:t.angle)&&(t.angle=Tt(t.angle)),t}class MN{static registerChart(t,e){MN._charts[t]=e}static registerSeries(t,e){MN._series[t]=e}static registerComponent(t,e,i){MN._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){MN._marks[t]=e}static registerRegion(t,e){MN._regions[t]=e}static registerTransform(t,e){MN.transforms[t]=e}static registerLayout(t,e){MN._layout[t]=e}static registerAnimation(t,e){MN._animations[t]=e}static registerImplement(t,e){MN._implements[t]=e}static registerChartPlugin(t,e){MN._chartPlugin[t]=e}static registerComponentPlugin(t,e){MN._componentPlugin[t]=e}static createChart(t,e,i){if(!MN._charts[t])return null;return new(0,MN._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!MN._charts[t])return null;const i=MN._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!MN._regions[t])return null;return new(0,MN._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!MN._regions[t])return null;return new(0,MN._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!MN._series[t])return null;return new(0,MN._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!MN._series[t])return null;return new(0,MN._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!MN._marks[t])return null;const s=new(0,MN._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(MN._components)}static getComponentInKey(t){return MN._components[t].cmp}static getLayout(){return Object.values(MN._layout)}static getLayoutInKey(t){return MN._layout[t]}static getSeries(){return Object.values(MN._series)}static getSeriesInType(t){return MN._series[t]}static getRegionInType(t){return MN._regions[t]}static getAnimationInKey(t){return MN._animations[t]}static getImplementInKey(t){return MN._implements[t]}static getSeriesMarkMap(t){return MN._series[t]?MN._series[t].mark:{}}static getChartPlugins(){return Object.values(MN._chartPlugin)}static getComponentPlugins(){return Object.values(MN._componentPlugin)}static getComponentPluginInType(t){return MN._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}MN._charts={},MN._series={},MN._components={},MN._marks={},MN._regions={},MN._animations={},MN._implements={},MN._chartPlugin={},MN._componentPlugin={},MN.transforms={fields:Gn,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}},MN.dataParser={csv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Vn.DSV,Zn(t)},dsv:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Vn.DSV;const i=Fn(Qn,e),{delimiter:s}=i;if(!y(s))throw new TypeError("Invalid delimiter: must be a string!");return qn(s).parse(t)},tsv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Vn.DSV,Jn(t)}},MN._layout={};const wN=(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))},TN=(t,e,i,s)=>{var n;const r=yR(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=V(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:CN(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,EN=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(V(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},PN=(t,e)=>{if(!t)return null;if(!uR(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=EN(t,(t=>"angle"===t.getOrient()),e),r=EN(t,(t=>"radius"===t.getOrient()),e),a=[],o=t=>t.getDimensionField()[0];return n&&n.forEach((t=>{var e;const n=t.getScale();if(n&&yR(n.type)){const l=n.domain(),h=n.range(),c=t.getCenter(),d={x:i-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let p=lR({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=U(e),n=W(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=hR(d),f=null===(e=r[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=TN(v,t,"polar",o);a.push({index:y,value:v,position:n.scale(v),axis:t,data:_})}})),r&&r.forEach((t=>{var e;const r=t.getScale(),l=null==r?void 0:r.range();if(r&&yR(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=lR({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=hR(c),g=null===(e=n[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=r.invert(p);if(u(m))return;let v=r.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=TN(m,t,"polar",o);a.push({index:v,value:m,position:r.scale(m),axis:t,data:y})}})),a.length?a:null};function BN(t){return"bottom"===t||"top"===t}function RN(t){return"left"===t||"right"===t}function LN(t){return"z"===t}function ON(t,e){return oH(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function IN(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function DN(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?BN(t)?"linear":"band":BN(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const FN=t=>t.fieldX[0],jN=t=>t.fieldY[0],zN=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},HN=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},NN=(t,e)=>t?e?FN:zN:e?jN:HN,VN=(t,e,i)=>{var s,n;if(!t)return null;if(!uR(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=EN(t,(t=>BN(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=EN(t,(t=>RN(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{yR(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((s=>{if(d.size>0){if(d.has(s)){const n=GN(s,i,t,NN(e,yR(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=GN(s,i,t,NN(e,n));r&&u.push(r)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},GN=(t,e,i,s)=>{const n=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return WN(t,a,s)},WN=(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=TN(e,t,"cartesian",null!=i?i:BN(t.getOrient())?FN:jN);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class UN{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:Bx)("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:Bx)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=VN(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=PN(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>yR(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return BN(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=WN(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var YN;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(YN||(YN={}));const KN={[YN.dimensionHover]:class extends UN{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!wN(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.canvas}),callback:this.onMouseOut}),Dx(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Dx(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[YN.dimensionClick]:class extends UN{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(e,i){this._callback=i.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},i.query),{source:t.Event_Source_Type.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let XN=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(KN[t]){const e=new KN[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(KN[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class $N{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(t.Event_Bubble_Level.vchart,[]),this._levelNodes.set(t.Event_Bubble_Level.chart,[]),this._levelNodes.set(t.Event_Bubble_Level.model,[]),this._levelNodes.set(t.Event_Bubble_Level.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const qN={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label",markLine:"markLine",markArea:"markArea",markPoint:"markPoint",polarMarkLine:"polarMarkLine",polarMarkArea:"polarMarkArea",polarMarkPoint:"polarMarkPoint",geoMarkPoint:"geoMarkPoint"};class ZN{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:P(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(e,i){var s,n,r,a,o;this._parseQuery(i);const l=this.getEventBubble((null===(s=i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);l.get(e)||l.set(e,new $N);if(l.get(e).addHandler(i,null===(r=i.filter)||void 0===r?void 0:r.level),this._isValidEvent(e)&&!h.has(e)){const t=this._onDelegate.bind(this);this._compiler.addEventListener(null===(a=i.filter)||void 0===a?void 0:a.source,e,t),h.set(e,t)}else if(this._isInteractionEvent(e)&&!h.has(e)){const t=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(o=i.filter)||void 0===o?void 0:o.source,e,t),h.set(e,t)}return this}unregister(e,i){var s,n,r,a;let o=!1;const l=this.getEventBubble((null===(s=null==i?void 0:i.filter)||void 0===s?void 0:s.source)||t.Event_Source_Type.chart),h=this.getEventListeners((null===(n=null==i?void 0:i.filter)||void 0===n?void 0:n.source)||t.Event_Source_Type.chart);if(i){const t=l.get(e);null==t||t.removeHandler(i),0===(null==t?void 0:t.getCount())&&(null==t||t.release(),l.delete(e),o=!0),(null===(r=null==i?void 0:i.wrappedCallback)||void 0===r?void 0:r.cancel)&&i.wrappedCallback.cancel()}else{const t=l.get(e);null==t||t.release(),l.delete(e),o=!0}if(o&&this._isValidEvent(e)){const s=h.get(e);this._compiler.removeEventListener((null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.source)||t.Event_Source_Type.chart,e,s),h.delete(e)}return this}dispatch(e,i,s){const n=this.getEventBubble(i.source||t.Event_Source_Type.chart).get(e);if(!n)return this;let r=!1;if(s){const t=n.getHandlers(s);r=this._invoke(t,e,i)}else{const s=n.getHandlers(t.Event_Bubble_Level.mark);if(r=this._invoke(s,e,i),!r){const s=n.getHandlers(t.Event_Bubble_Level.model);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.chart);r=this._invoke(s,e,i)}if(!r){const s=n.getHandlers(t.Event_Bubble_Level.vchart);r=this._invoke(s,e,i)}}return this}clear(){for(const e of this._viewListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.chart,e[0],e[1]);this._viewListeners.clear();for(const e of this._windowListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.window,e[0],e[1]);this._windowListeners.clear();for(const e of this._canvasListeners.entries())this._compiler.removeEventListener(t.Event_Source_Type.canvas,e[0],e[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&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 qN[a]&&(a=qN[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.query||this._filter(a,e,i)){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(e){return e?e.level?e.level:p(e.id)?t.Event_Bubble_Level.model:t.Event_Bubble_Level.vchart:t.Event_Bubble_Level.vchart}_parseQuery(e){var i;const s=e.query;(null==s?void 0:s.throttle)?e.wrappedCallback=ut(e.callback,s.throttle):(null==s?void 0:s.debounce)&&(e.wrappedCallback=dt(e.callback,s.debounce));let n=this._getQueryLevel(s),r=null,a=t.Event_Source_Type.chart,o=null,l=null,h=null;return(null==s?void 0:s.nodeName)&&(o=s.nodeName),(null==s?void 0:s.markName)&&(l=s.markName),!(null==s?void 0:s.type)||n!==t.Event_Bubble_Level.model&&n!==t.Event_Bubble_Level.mark||(r=s.type),(null==s?void 0:s.source)&&(a=s.source),p(null==s?void 0:s.id)&&(h=null==s?void 0:s.id,n=t.Event_Bubble_Level.model),e.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:null!==(i=null==s?void 0:s.filter)&&void 0!==i?i:null},e}getEventBubble(e){switch(e){case t.Event_Source_Type.chart:return this._viewBubbles;case t.Event_Source_Type.window:return this._windowBubbles;case t.Event_Source_Type.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(e){switch(e){case t.Event_Source_Type.chart:return this._viewListeners;case t.Event_Source_Type.window:return this._windowListeners;case t.Event_Source_Type.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(e){return Mj.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&EO.hasInteraction(e)}}function JN(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function QN(t,e,i){t.getParser(e)||t.registerParser(e,i)}const tV=new Map;let eV;function iV(){eV||(eV=new Ar,QN(eV,"geojson",vr),QN(eV,"topojson",_r),JN(eV,"simplify",Nn))}function sV(t,e,i={type:"geojson",centroid:!0}){tV.has(t)&&Px(`map type of '${t}' already exists, will be overwritten.`),iV();const s=new Mr(eV),n=I({},{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}),tV.set(t,s)}function nV(t){tV.has(t)?tV.delete(t):Px(`map type of '${t}' does not exists.`)}function rV(t,e=!1){let i=e;return t.latestData instanceof Mr&&(i=!1),i?B(t.latestData):t.latestData.slice()}const aV=(t,e)=>0===t.length?[]:1===t.length?rV(t[0],null==e?void 0:e.deep):t.map((t=>rV(t,null==e?void 0:e.deep)));function oV(t,e,i){JN(e=e instanceof Ar?e:t.dataSet,"copyDataView",aV);const s=new Mr(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:cV.copyDataView}),s}function lV(t,e,i=[],s={}){var n,r,a;if(t instanceof Mr)return t;const{id:o,values:l=[],fromDataIndex:h,fromDataId:c,transforms:d=[]}=t,u=t.parser?B(t.parser):{clone:!0},p=B(t.fields);let g;u.clone=!(!1===u.clone);const f=i.find((t=>t.name===o));if(f)g=f;else{const t={name:o};if(p&&(t.fields=p),g=new Mr(e,t),"string"==typeof c){const t=i.find((t=>t.name===c));if(!t)return(null!==(n=s.onError)&&void 0!==n?n:Bx)(`no data matches fromDataId ${c}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else if("number"==typeof h){const t=i[h];if(!t)return(null!==(r=s.onError)&&void 0!==r?r:Bx)(`no data matches fromDataIndex ${h}`),null;g.parse([t],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,u):!y(l)||u&&!["csv","dsv","tsv"].includes(u.type)?(g.parse([]),Px("values should be array")):g.parse(l,null!==(a=u)&&void 0!==a?a:{type:"csv"});d&&d.length&&d.forEach((t=>{e.getTransform(t.type)&&g.transform(t)}))}return g}function hV(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var cV;!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"}(cV||(cV={}));const dV=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._container=e,this._option=i}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new Z(null!==(t=this._option.logLevel)&&void 0!==t?t:q.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new CD(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{mode:mV(this._option.mode),autoFit:!1,eventConfig:{gesture:Dx(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=db.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(db.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(db.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(e,i,s){var n,r;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=function(t,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:t,type:i,source:e,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};s.call(null,g)}.bind(this);this._viewListeners.set(s,{type:i,callback:t}),null===(n=this._view)||void 0===n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.window){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._windowListeners.set(s,{type:i,callback:t});const n=this._getGlobalThis();null==n||n.addEventListener(i,t)}else if(e===t.Event_Source_Type.canvas){const t=function(t){const n={event:t,type:i,source:e,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};s.call(null,n)}.bind(this);this._canvasListeners.set(s,{type:i,callback:t});const n=null===(r=this.getStage())||void 0===r?void 0:r.window;null==n||n.addEventListener(i,t)}}removeEventListener(e,i,s){var n,r,a,o,l;if(!1!==this._option.interactive)if(e===t.Event_Source_Type.chart){const t=null===(n=this._viewListeners.get(s))||void 0===n?void 0:n.callback;t&&(null===(r=this._view)||void 0===r||r.removeEventListener(i,t)),this._viewListeners.delete(s)}else if(e===t.Event_Source_Type.window){const t=this._getGlobalThis(),e=null===(a=this._windowListeners.get(s))||void 0===a?void 0:a.callback;e&&(null==t||t.removeEventListener(i,e)),this._windowListeners.delete(s)}else if(e===t.Event_Source_Type.canvas){const t=null===(o=this.getStage())||void 0===o?void 0:o.window,e=null===(l=this._canvasListeners.get(s))||void 0===l?void 0:l.callback;t&&e&&(null==t||t.removeEventListener(i,e)),this._canvasListeners.delete(s)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return Ix(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function yV(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:Bx)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function _V(t){t.crosshair=V(t.crosshair||{}).map((e=>VH({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function bV(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}=ue(l,i.width,i.height);a=t,o=e}else if(h&&Ix(e.mode)){let t;t=y(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ue(t,i.width,i.height);a=e,o=s}else if(Fx(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 xV(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec")}),t}function SV(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(gV||(gV={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(fV||(fV={}));class AV{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,I({},AV.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=V(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]))))}}AV.defaultMarkInfo={};class kV{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new AV,this._markReverse=new AV,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(gV.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(gV.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(gV.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(gV.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(gV.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(gV.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){E(t.stateStyle[gV.STATE_DIMENSION_HOVER])||this._marks.addMark(t),E(t.stateStyle[gV.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(YN.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const MV={};Object.values(gV).forEach((t=>{MV[t]=!0}));const wV={[gV.STATE_HOVER]:gV.STATE_HOVER_REVERSE,[gV.STATE_SELECTED]:gV.STATE_SELECTED_REVERSE,[gV.STATE_DIMENSION_HOVER]:gV.STATE_DIMENSION_HOVER_REVERSE};function TV(t){return wV[t]}class CV{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!E(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=TV(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=TV(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=TV(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=TV(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}}class EV{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class PV extends EV{constructor(){super(...arguments),this.id=zx(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class BV extends PV{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=pV.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class RV extends EV{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new BV(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class LV extends RV{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(I(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class OV extends LV{constructor(){super(...arguments),this.id=zx(),this.stateKeyToSignalName=t=>`${gL}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===uV.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===uV.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?uV.none:uV.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?uV.exit:"update"===e.diffState?uV.update:uV.appear}}}}class IV{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=>VH({},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 DV extends EV{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=IV,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new AV,this._lastLayoutRect=null,this.id=zx(),this.userId=t.id,this._spec=t,this.effect={},this.event=new XN(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${gL}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={}){const{type:i,name:s}=t,n=MN.createMark(i,s,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==n||n.created(),n}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return 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}}class FV{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=cH(dH(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:hH(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:hH(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:hH(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:hH(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:hH(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:hH(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=hH(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=hH(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=hH(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;k(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),k(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class jV extends DV{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new FV(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=I(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=I(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 zV extends IV{_initTheme(t,e){return{spec:t,theme:this._theme}}}class HV extends jV{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=zV,this.modelType="region",this.specKey="region",this.type=HV.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new CV,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian",this._option.animation&&(this.animate=new OV({getCompiler:i.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e;this.initLayout(),super.created();const i=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",t.LayoutZIndex.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(t.LayoutZIndex.Mark+1)),this.createTrigger()}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setZIndex(s);const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return 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||V(t.userId).includes(e.userId))&&(!p(t.specIndex)||V(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new kV(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in fV)E(t.stateStyle[fV[e]])||this.interaction.registerMark(fV[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function NV(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 VV(t,e,i){e?t.forEach((t=>{const e=G(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=G(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 GV(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 WV(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),GV(c,!0,u,o),s&&VV(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function UV(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),GV(c,!1,u,a),s&&VV(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function KV(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=NV(t);s.length&&WV(s,e,i,!1,"left"),n.length&&WV(n,e,i,!0,"left"),r.length&&UV(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=NV(t);s.length&&YV(s,e,i,!1,"top"),n.length&&YV(n,e,i,!0,"top"),r.length&&KV(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=NV(t);s.length&&WV(s,e,i,!1,"right"),n.length&&WV(n,e,i,!0,"right"),r.length&&UV(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=NV(t);s.length&&YV(s,e,i,!1,"bottom"),n.length&&YV(n,e,i,!0,"bottom"),r.length&&KV(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{t.setLayoutRect({width:s,height:n}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Bx)("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}}}XV.type="base";const $V=["line","area","trail"];function qV(t){return $V.includes(t)}class ZV extends LV{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(qV)?s:!t.mark||qV(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!MV[t])).map((t=>[t,10])),s=!t.mark||qV(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(_(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(gL)));s=t.datums.some((t=>i&&_(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(gL)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(mR(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class JV extends PV{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=pV.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class QV extends JV{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${gL}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class tG extends PV{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}getClip(){return this._clip}setClip(t){this._clip=t}setStateSortCallback(t){this._stateSort=t}constructor(e,i,s){super(e),this.grammarType=pV.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=t.LayoutZIndex.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=i,this.model=s,this.key=e.key,this.state=new ZV(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new XN(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new QV(t)}stateKeyToSignalName(t){return`${gL}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(u(this._data))return;this._data.compile();const e=this._data.getProduct();p(this._product)&&p(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=gV.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getFacet())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=gV.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var e,i,s,n;if(this._animationConfig){let r;if("component"===this.type)r=null===(e=this.model.animate)||void 0===e?void 0:e.getAnimationStateSignalName();else{const t=null===(s=(i=this.model).getRegion)||void 0===s?void 0:s.call(i);r=null===(n=null==t?void 0:t.animate)||void 0===n?void 0:n.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[r])||void 0===s?void 0:s.callback(t,e)},dependency:r}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(t.VGRAMMAR_HOOK_EVENT.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===uV.appear&&this.runAnimationByState(uV.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(uV.normal)})))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments,clip:!!this._clip||!1!==this._clip&&void 0,clipPath:this._clip||void 0};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey,this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class eG extends tG{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._interactive=t.interactive),p(t.zIndex)&&this.setZIndex(t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Tt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart].includes(e)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&VH(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(vR(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=nH(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):Qj.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):vR(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>t.style.scale.scale(e[t.style.field]):(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e,i,s){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark,i);const n=e.state;n&&Object.keys(n).forEach((e=>{const s=n[e];if("style"in s){const n=s.style;let r={stateValue:e};"level"in s&&(r.level=s.level),"filter"in s&&(r=d(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r)),this.state.addStateInfo(r),this.setStyle(n,e,t.AttributeLevel.User_Mark,i)}else this.setStyle(s,e,t.AttributeLevel.User_Mark,i)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=$z(Xz(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},sz[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=Vt.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)Qj.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=$z(Xz(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class iG extends eG{constructor(){super(...arguments),this.type=iG.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Px("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?(Px("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}iG.type="group";const sG=()=>{Jw(),jw(),EO.registerGraphic(FL.group,rg),MN.registerMark(iG.type,iG)},nG={type:"clipIn"},rG={type:"fadeIn"};function aG(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 rG;default:return nG}}const oG={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"}},lG={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},hG={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},cG=()=>{MN.registerAnimation("scaleInOut",(()=>lG))},dG=()=>{MN.registerAnimation("fadeInOut",(()=>hG))},uG=(t,e)=>({appear:aG(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:xu,duration:oG.update.duration,easing:oG.update.easing}],disappear:{type:"clipOut"}}),pG=()=>{MN.registerAnimation("line",uG)},gG=()=>{CD.useRegisters([oj,lj,hj,cj,dj,uj,ZF,JF])},fG={measureText:(t,e,i,s)=>((t,e,i)=>MT(t,e,i,{fontFamily:LH.fontFamily,fontSize:LH.fontSize}))(e,i,s).measure(t)};class mG{static instance(){return mG.instance_||(mG.instance_=new mG),mG.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 vG{constructor(){this.id=zx(),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))?Px("不要重复添加相同的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 yG extends vG{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class _G{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>MN.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>MN.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>MN.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return MN.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>MN.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){MN.registerTransform(t,e)}static registerFunction(t,e){t&&e&&mG.instance().registerFunction(t,e)}static unregisterFunction(t){t&&mG.instance().unregisterFunction(t)}static getFunction(t){return t?mG.instance().getFunction(t):null}static getFunctionList(){return mG.instance().getFunctionNameList()}static registerMap(t,e,i){const s=MN.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=MN.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,tV.get(e);var e}static hideTooltip(t=[]){rN.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 Z.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c;this.id=zx(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=dt(((...t)=>{this._doResize()}),100),this._option=I(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const d=this._option,{dom:u,renderCanvas:p,mode:g,stage:f,poptip:m}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),_=Ix(g);_&&u&&(this._container=y(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),f&&(this._stage=f),"node"===g||this._container||this._canvas||this._stage?(_?cA(Bc):"node"===g&&Wk(Bc),this._viewBox=this._option.viewBox,this._currentThemeName=aN.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new vV({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==m?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new ZN(this,this._compiler),this._event=new XN(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!_&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),rN.registerInstance(this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=VH({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=lN(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;_G.getFunctionList()&&_G.getFunctionList().length&&(t=hN(t,_G)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=MN.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=MN.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=MN.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.ALL_ANIMATION_END,(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(t.ChartEvent.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;e&&(this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return bV(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:fL,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:mL})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))}_initDataSet(t){this._dataSet=t instanceof Ar?t:new Ar,QN(this._dataSet,"dataview",br),QN(this._dataSet,"array",s),JN(this._dataSet,"stackSplit",dV),JN(this._dataSet,"copyDataView",aV);for(const t in MN.transforms)JN(this._dataSet,t,MN.transforms[t]);for(const t in MN.dataParser)QN(this._dataSet,t,MN.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(uV.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(uV.update,!0)})))}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,rN.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(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=V(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i){return u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=V(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=V(this._spec.data);return V(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));if(o)o instanceof Mr?(o.setFields(B(a)),o.parse(n,B(r))):(o.values=n,p(r)&&(o.parser=r),p(a)&&(o.fields=a));else{const s=lV(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});_(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;z(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),xV(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||GH(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||GH(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=VH({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i;const s=this._option.theme,n=null===(e=this._spec)||void 0===e?void 0:e.theme;if(t&&(this._currentThemeName=t),E(s)&&E(n))this._currentTheme=oN(this._currentThemeName,!0);else if(y(s)&&(!n||y(n))||y(n)&&(!s||y(s))){const t=WH({},oN(this._currentThemeName,!0),oN(s,!0),oN(n,!0));this._currentTheme=t}else{const t=WH({},oN(this._currentThemeName),oN(s),oN(n));this._currentTheme=XH(t)}var r;r=P(this._currentTheme,"component.poptip"),Va(FT.poptip,DT,r),null===(i=this._compiler)||void 0===i||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Ix(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return oN(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!aN.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!aN.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield yV(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(!Ix(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?null===document||void 0===document?void 0:document.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,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?uH(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(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 Px("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?uH(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Px("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return mG.instance().getFunction(t)}registerFunction(t,e){t&&e&&mG.instance().registerFunction(t,e)}unregisterFunction(t){t&&mG.instance().unregisterFunction(t)}getFunctionList(){return mG.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=MN.getChartPlugins();t.length>0&&(this._chartPlugin=new yG(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}_G.InstanceManager=rN,_G.ThemeManager=aN,_G.globalConfig={uniqueTooltip:!0},_G.Utils=fG,_G.vglobal=db;MN.registerRegion("region",HV),MN.registerLayout("base",XV),sG(),CD.useRegisters([mF,vF]),CD.useRegisters([_j,bj,QF,tj,vj,yj,xj,Sj,Aj]),qO(),$O(),tN(IH.name,IH),Z.getInstance(q.Error);const bG=(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(uL).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=MN.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=V(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=V(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s.type===t&&f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e}))}))}else{const s=MN.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=V(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);V(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},xG=(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=bG(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||V(e).some((e=>d(e)?e(t,i,s):DH(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=VH({},i),m=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:VH(f,m),hasChanged:!0};const i=VH({},t,m);FH(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[c])?f[c].push(t):u(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}};class SG{constructor(t){this.id=zx(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const AG=t=>{MN.registerChartPlugin(t.type,t)};class kG extends SG{constructor(){super(kG.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[kG.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[kG.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"updateSpec":case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=jH(this._option.globalInstance.getSpec(),["data",kG.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=jH(this._baseChartSpec,["data",kG.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=xG(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=jH(i,["data",kG.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()}}kG.pluginType="chart",kG.specKey="media",kG.type="MediaQueryPlugin";const MG=/\{([^}]+)\}/,wG=/\{([^}]+)\}/g,TG=/:/;class CG extends SG{constructor(){super(CG.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=Ce.getInstance().format,this._numericSpecifier=Ce.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[CG.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)),MN.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=MG.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(wG,((t,i)=>{if(!TG.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(Me.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}CG.pluginType="chart",CG.specKey="formatter",CG.type="formatterPlugin";function EG(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function PG(t,e){const i=e[1]-e[0],s=e[1]*e[0]<0;let n=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(n=1,r=0):e[0]>0&&(n=0,r=1):(n/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:n,positive:r,includeZero:s,domain:e,extendable_min:!k(a.min),extendable_max:!k(a.max)}}function BG(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 RG(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 LG(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 OG(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 IG=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>"ticks"===t.type)))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=p[1]-p[0];if(0===g)return t;const f=c.domain(),m=f[1]-f[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return m*e+f[0]}));return zE(v)};class DG extends SG{constructor(){super(DG.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!mR(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&&EG(c)&&EG(d)))return;const u=PG(t,c),p=PG(e,d),{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!RG(u,p))return}else if(0===_&&0===b){if(!RG(p,u))return}else if(y||A)if(y&&!A){if(!BG(u,p))return}else if(A&&!y){if(!BG(p,u))return}else{if(f===b)return;if(f>b){if(!LG(u,p))return}else if(!LG(p,u))return}else{if(0===f&&0===_){if(!OG(u,p))return}else if(0===b&&0===g&&!OG(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(n,i)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){JN(e.getOption().dataSet,"tickAlign",IG);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}DG.pluginType="component",DG.type="AxisSyncPlugin";const FG=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,jG=(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},Zm||(Zm=$m.CreateGraphic("richtext",{})),Zm.setAttributes(a),Zm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},zG="vchart-tooltip-container",HG={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function NG(t,e){return P(e,`component.${t}`)}function VG(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=MN.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const GG={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function WG(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 UG(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 YG(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function KG(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const XG=(t,e,i)=>{var s;const n=null!==(s="band"===e?NG("axisBand",i):["linear","log","symlog"].includes(e)?NG("axisLinear",i):{})&&void 0!==s?s:{},r=BN(t)?NG("axisX",i):RN(t)?NG("axisY",i):NG("axisZ",i);return VH({},NG("axis",i),n,r)},$G=(t,e,i)=>{var s;const n=null!==(s="band"===e?NG("axisBand",i):"linear"===e?NG("axisLinear",i):{})&&void 0!==s?s:{},r=NG("angle"===t?"axisAngle":"axisRadius",i);return VH({},NG("axis",i),n,r)},qG=t=>"band"===t||"ordinal"===t||"point"===t;function ZG(t,e){return{id:t,label:t,value:e,rawValue:t}}function JG(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function QG(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const tW=(t=3,e,i,s,n,r,a,o=!1,l,h)=>{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,f=0,m=0;if(s.size){const t=Array.from(s.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(f),y=!!n.size&&Number.isFinite(m),_=o&&!v&&p(l),b=o&&!y&&p(h);let x,S,A;c&&(x=_?l:{height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:v,axis:u}),d&&(S=b?h:{width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:y,axis:g});let k,M=0,w=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(yR(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(mR(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=QG(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!_){const e=WG(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(yR(r.type))k=r.bandwidth(),0===k&&r.step&&(w=r.step());else if(mR(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=QG(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=WG(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!_){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(iW(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=f+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&eW(t,"top",r.label),e.visible&&eW(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(iW(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=m+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&eW(t,"left",a.label),e.visible&&eW(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:w,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},eW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=VG(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},iW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},sW=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=rW(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},nW=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=rW(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},rW=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a},aW=(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},oW={left:["left","center"],right:["right","center"],top:["center","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["center","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"],inside:["center","center"],center:["center","center"],centerBottom:["center","centerBottom"],centerTop:["center","centerTop"],centerLeft:["centerLeft","center"],centerRight:["centerRight","center"]},lW=(t,e)=>{var i,s;return null!==(s=null===(i=oW[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},hW=(t,e)=>{var i,s;return null!==(s=null===(i=oW[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},cW=(t,e,i)=>{const s=new Map,n=new Map;t.forEach((({axis:t,value:e})=>{["top","bottom"].includes(t.getOrient())?s.set(t.getSpecIndex(),{value:e,axis:t}):n.set(t.getSpecIndex(),{value:e,axis:t})}));const r={visible:!!s.size,type:"rect"},a={visible:!!n.size,type:"rect"},{x:o,y:l,offsetWidth:h,offsetHeight:c,bandWidth:d,bandHeight:u}=tW(3,e,i,s,n,r,a);return o?sW(r,o,d,h):l?nW(a,l,u,c):void 0},dW={fontFamily:LH.fontFamily,spacing:10,wordBreak:"break-word"};function uW(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:dW),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const pW=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},gW=(t,e)=>p(e)?t.map((t=>e[t])):void 0,fW=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),mW=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function vW(e,i,s){var n,r,a;const o=Object.assign({regionIndex:0},i),l=s.getOption(),h=l.getRegionsInUserIdOrIndex(p(o.regionId)?[o.regionId]:void 0,p(o.regionIndex)?[o.regionIndex]:void 0)[0];if(!h)return"none";const c=yW(e,h),d=null!==(n=o.activeType)&&void 0!==n?n:c.length>1?"dimension":"mark",g=h.getLayoutStartPoint(),f=h.getLayoutRect(),m=l.globalInstance.getContainer(),v=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),y=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>fW(i,s)(t)&&fW(n,r)(t)&&(u(a)||fW([a],[o])(t))));return l},_=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),f.width),y:Math.min(Math.max(t.y,0),f.height)}))(t),n=null!==(e=o.x)&&void 0!==e?e:g.x+s.x,r=null!==(i=o.y)&&void 0!==i?i:g.y+s.y;return{canvasX:n,canvasY:r,clientX:v.x+n,clientY:v.y+r}};if("dimension"===d){const i=c[0];if(!i)return"none";const n=new Map;c.forEach((t=>{var e;n.has(t.series)||n.set(t.series,[]),null===(e=n.get(t.series))||void 0===e||e.push(t)}));const a=[{value:e[i.data.dimensionFields[0]],data:[...n.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=n.get(t))||void 0===e?void 0:e.map((t=>y(t))))&&void 0!==i?i:[]}}))}];p(i.dimType)&&(a[0].position=i.pos[i.dimType],a[0].dimType=i.dimType);const o={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:a,chart:null!==(r=l.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:t.Event_Source_Type.chart,event:_({x:c.reduce(((t,e)=>t+e.pos.x),0)/c.length,y:c.reduce(((t,e)=>t+e.pos.y),0)/c.length}),item:void 0,itemMap:new Map};s.processor.dimension.showTooltip(a,o,!1);const h=l.globalInstance;return _G.globalConfig.uniqueTooltip&&_G.hideTooltip(h.id),d}if("mark"===d){const i=c[0];if(!i)return"none";const n=Object.assign(Object.assign({},y(i)),e),r=[{datum:[n],series:i.series}],o=[{value:n[i.data.dimensionFields[0]],data:r}],h={changePositionOnly:!1,tooltip:null,dimensionInfo:o,chart:null!==(a=l.globalInstance.getChart())&&void 0!==a?a:void 0,datum:n,model:i.series,source:t.Event_Source_Type.chart,event:_(i.pos),item:void 0,itemMap:new Map};s.processor.mark.showTooltip({datum:n,mark:null,series:i.series,dimensionInfo:o},h,!1);const u=l.globalInstance;return _G.globalConfig.uniqueTooltip&&_G.hideTooltip(u.id),d}return"none"}const yW=(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=gW(c,t);let y=gW(d,t);const _=mW(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(fW(c,v));if(!_&&(y=gW(d,i),!mW(y)))return;const n=e.type===uL.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:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=yR(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(fW(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=gW(d,o),!mW(y))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: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(fW(c,n));if(!_&&(y=gW(d,r),!mW(y)))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:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===uL.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(fW(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=gW(d,i),!mW(y))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:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},_W=t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))};const bW=(t,e,i)=>{var s,n;return null!==(n=null===(s=t.tooltipHelper)||void 0===s?void 0:s.getDefaultTooltipPattern(e,i))&&void 0!==n?n:null};class xW{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class SW extends xW{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?V(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 V(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,s;const n=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(s=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==s?s:{},a=Object.assign(Object.assign({},r),n);["mark","dimension","group"].forEach((t=>{const e=a[t];p(e)&&(a[t]=Object.assign(Object.assign({},e),{title:kW(e.title,{seriesId:this.series.id},!0),content:MW(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=_W(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.groupTooltipTitleCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.groupTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const AW=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},kW=(t,e,i)=>p(t)?d(t)?(...s)=>AW(t(...s),e,i):AW(t,e,i):void 0,MW=(t,e,i)=>{const s=p(t)?V(t).map((t=>d(t)?(...s)=>V(t(...s)).map((t=>AW(t,e,i))):AW(t,e,i))):void 0;return s},wW=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=bW(e,t))&&void 0!==s?s:{});break;case"dimension":if(null==i?void 0:i.length){const t=[];i.forEach((({data:e})=>e.forEach((e=>{const{series:s}=e,n=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=bW(s,"dimension",n);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...V(t))})),n=Object.assign(Object.assign({},t[0]),{content:e})}}return n},TW=(t,e,i)=>{var s,n;let r={};switch(t){case"mark":case"group":if(e){const i=null!==(n=null===(s=e.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==n?n:{};r=i[t]?B(i[t]):{}}break;case"dimension":if(null==i?void 0:i.length){const t=CW(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return p(null==i?void 0:i.dimension)&&_W(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>u(t)))?e=void 0:t.forEach((({content:t})=>{u(t)||(d(t)?null==e||e.push(t):null==e||e.push(...V(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},CW=ot((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),EW=t=>{const e={};return t.forEach((t=>{var i;const s=null!==(i=t.seriesId)&&void 0!==i?i:0;e[s]||(e[s]=t)})),e},PW=(t,e,i,s,n)=>{var r,a,o;i&&(i.shapeSize=null!==(r=i.shapeSize)&&void 0!==r?r:i.size);const l=[t,e,i,null!==(o=null==s?void 0:s[null!==(a=null==t?void 0:t.seriesId)&&void 0!==a?a:0])&&void 0!==o?o:null==s?void 0:s[0],n].filter(p),h=new Set(l.reduce(((t,e)=>t.concat(Object.keys(e))),[]).filter((t=>t.toLowerCase().includes("shape")))),c={};return h.forEach((t=>{let e,i=0;do{e=l[i++][t]}while(i{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=VG(void 0,s,t,e);i&&r&&(n=i(...r))}return n},RW=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class LW{}LW.dom=`${gL}_TOOLTIP_HANDLER_DOM`,LW.canvas=`${gL}_TOOLTIP_HANDLER_CANVAS`;const OW=20,IW={key:"其他",value:"..."},DW=(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)},FW=(t,e,i)=>{var s,n,r,a;if(!e||"mouseout"===(null===(s=null==i?void 0:i.event)||void 0===s?void 0:s.type))return null;const o={title:{},content:[]},l=RW(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:f,hasShape:m,valueFormatter:v}=null!=l?l:{},y=!1!==BW(h,e,i);if(l&&y){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(e);o.title={value:DW(BW(c,t,i,v),p,g),valueStyle:BW(f,t,i),hasShape:m}}else o.title={hasShape:!1,visible:!1};const _=((t,e,i)=>{if(u(t))return t;let s=[];return V(t).forEach((t=>{d(t)?s=s.concat(V(t(e,i))):s.push(t)})),s})(t.content,e,i),{maxLineCount:b=OW}=t,x=t.othersLine?Object.assign(Object.assign({},IW),t.othersLine):IW,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=_?_:[]){const s=jW(e,t,i);if(!1!==s.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},s),x));break}if(!(o.content.lengthu(t.seriesId)||t.seriesId===s.id)))&&void 0!==a?a:[];for(const s of e){for(const e of t){const t=jW(s,e,i);if(!1!==t.visible){if(o.content.length===b-1){o.content.push(Object.assign(Object.assign({},t),x));break}if(!(o.content.length=b)break}if(o.content.length>=b)break}if(o.content.length>=b)break}}return o.title&&(o.content.length>0&&o.content[0].shapeType?(u(o.title.shapeType)&&(o.title.shapeType=o.content[0].shapeType),u(o.title.shapeColor)&&(o.title.shapeColor=o.content[0].shapeColor)):o.title.hasShape=!1),o},jW=(t,e,i)=>{const s=DW(BW(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=DW(BW(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==BW(e.visible,t,i)&&(p(s)||p(n)),a=BW(e.isKeyAdaptive,t,i),o=BW(e.spaceRow,t,i),l=BW(e.shapeType,t,i),h=BW(e.shapeColor,t,i),c=BW(e.shapeFill,t,i),d=BW(e.shapeStroke,t,i),u=BW(e.shapeLineWidth,t,i),g=BW(e.shapeHollow,t,i),f=BW(e.keyStyle,t,i),m=BW(e.valueStyle,t,i);return{key:s,value:n,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:l,shapeFill:c,shapeStroke:d,shapeLineWidth:u,shapeHollow:g,shapeColor:h,keyStyle:f,valueStyle:m,spaceRow:o,datum:t}};class zW extends SG{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this._changeTooltip=(t,e,i)=>this._isReleased?1:t?this._changeTooltipPosition(e,i):(this._clearAllCache(),this._updateTooltip(!1,e),0),this._changeTooltipPosition=(t,e)=>{var i,s,n;if(this._isReleased)return 1;const r=t.event,{tooltipSpec:a,tooltipActual:o,changePositionOnly:l}=t;if(a.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(t))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout((()=>{this._isPointerEscaped=!0}),300)),0;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(t)}const h=o.activeType;if(a.handler)return null!==(n=null===(s=(i=a.handler).showTooltip)||void 0===s?void 0:s.call(i,h,e,t))&&void 0!==n?n:0;const c=a[h];if(!c)return 1;const d=this._getActualTooltipPosition(o,t,this._getTooltipBoxSize(o,l));o.position=d,c.updatePosition&&(o.position=c.updatePosition(o.position,e,t));let u=!1!==(null==c?void 0:c.visible);return e&&"pointerout"!==r.type&&o.visible&&(o.title||o.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},t),{changePositionOnly:l})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h;const c=e.event,{tooltipSpec:u}=e,f=null===(s=e.dimensionInfo)||void 0===s?void 0:s[0],m={x:1/0,y:1/0};let{offsetX:v,offsetY:y}=this._option;if(!u)return this._cacheTooltipPosition=void 0,m;const{activeType:_,data:b}=t,x=u[_],A=RW(x.position,b,e),M=null!==(n=RW(x.positionMode,b,e))&&void 0!==n?n:"mark"===_?"mark":"pointer",w=this._getParentElement(u),{width:T=0,height:C=0}=null!=i?i:{},E="canvas"===u.renderMode,P=null===(r=null==e?void 0:e.chart)||void 0===r?void 0:r.getCanvasRect(),B=null!==(a=null==P?void 0:P.width)&&void 0!==a?a:fL,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:mL;let L=!1;const O={width:0,height:0};let I={x:0,y:0},D={x:0,y:0},F=1,j=1;if(Ix(this._env)&&!u.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!E){D=null!==(l=null==w?void 0:w.getBoundingClientRect())&&void 0!==l?l:m;const t=null!==(h=this._compiler.getCanvas())&&void 0!==h?h:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();I={x:e.x-D.x,y:e.y-D.y},F=FG(t,e),j=FG(w,D)}}else O.width=B,O.height=R;const z=j/F;let H,N,V,G,W=A,U=A;const Y=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(v=null!=s?s:v,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.x1+l.x,a=i.x2+l.x)}else if("crosshair"===i&&"cartesian"===(null===(n=null==f?void 0:f.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=cW(e.dimensionInfo,uR(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(lW(t)){case"left":H=r-T*z-v;break;case"right":H=a+v;break;case"center":H=(r+a)/2-T*z/2;break;case"centerLeft":H=(r+a)/2-T*z-v;break;case"centerRight":H=(r+a)/2+v}},K=({orient:t,mode:i,offset:s})=>{var n;let r,a;const o=e.model,l=null==o?void 0:o.getLayoutStartPoint();if(y=null!=s?s:y,"mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&l&&(r=i.y1+l.y,a=i.y2+l.y)}else if("crosshair"===i&&"cartesian"===(null===(n=null==f?void 0:f.axis)||void 0===n?void 0:n.getCoordinateType())){L=!0;const t=cW(e.dimensionInfo,uR(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(hW(t)){case"top":N=r-C*z-y;break;case"bottom":N=a+y;break;case"center":N=(r+a)/2-C*z/2;break;case"centerTop":N=(r+a)/2-C*z-y;break;case"centerBottom":N=(r+a)/2+y}};if(g(A)){if(g(X=A)&&(p(X.left)||p(X.right)||p(X.top)||p(X.bottom))){const{left:t,right:e,top:i,bottom:s}=A;H=aW(t,c),N=aW(i,c),V=aW(e,c),G=aW(s,c)}else if((t=>g(t)&&(p(t.x)||p(t.y)))(A)){const{x:t,y:e}=A;S(t)||d(t)?H=aW(t,c):Y(t),S(e)||d(e)?N=aW(e,c):K(e)}}else p(A)&&(Y({orient:A,mode:M}),K({orient:A,mode:M}));var X;let $,q;const{canvasX:Z,canvasY:J}=c;if(k(H))$=H;else if(k(V))$=B-T*z-V;else{const t=Z;switch(lW(W,"right")){case"center":$=t-T*z/2;break;case"left":case"centerLeft":$=t-T*z-v;break;case"right":case"centerRight":$=t+v}}if(k(N))q=N;else if(k(G))q=R-C*z-G;else{const t=J;switch(hW(U,"bottom")){case"center":q=t-C*z/2;break;case"top":case"centerTop":q=t-C*z-y;break;case"bottom":case"centerBottom":q=t+y}}$*=F,q*=F,Ix(this._env)&&($+=I.x,q+=I.y),$/=j,q/=j;const{width:Q,height:tt}=O,et=()=>$*j+D.x<0,it=()=>($+T)*j+D.x>Q,st=()=>q*j+D.y<0,nt=()=>(q+C)*j+D.y>tt,rt=()=>{et()&&(L?$=-D.x/j:"center"===lW(A,"right")?$+=v+T/2:$+=2*v+T)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-T:"center"===lW(A,"right")?$-=v+T/2:$-=2*v+T)},lt=()=>{it()&&($=(Q-D.x)/j-T)},ht=()=>{st()&&(L?q=-D.y/j:"center"===hW(A,"bottom")?q+=y+C/2:q+=2*y+C)},ct=()=>{st()&&(q=0-D.y/j)},dt=()=>{nt()&&(L?q=(tt-D.y)/j-C:"center"===hW(A,"bottom")?q-=y+C/2:q-=2*y+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(lW(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(hW(A,"bottom")){case"center":case"centerTop":case"centerBottom":st()?(ht(),ut()):(dt(),ct());break;case"top":ht(),ut();break;case"bottom":dt(),ct()}const pt={x:$,y:q};return this._cacheTooltipPosition=pt,this._cacheTooltipSize={width:T,height:C},pt}}get env(){return this._env}onAdd(t){super.onAdd(t);const e=t.component;this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const s=null!==(t=this._component.getSpec())&&void 0!==t?t:{};s.handler?null===(i=(e=s.handler).release)||void 0===i||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=S(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ut(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},HG),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:HG.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:HG.offsetY})}_getTooltipBoxSize(t,e){var i,s,n;if(!e||u(this._attributes)){const e=null!==(s=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme())&&void 0!==s?s:{};this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,maxContentHeight:y,align:_}=l,b=de(d.padding),x=dH(d.padding),S=uW(Object.assign({textAlign:"right"===_?"right":"left"},u),i),A=uW(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=uW(m,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},w={panel:pW(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:y,enterable:h,transitionDuration:c,align:_},{title:T={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const L=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),O=!!L.length;let I=0,D=0,F=0,j=0;if(O){const t=[],e=[],i=[],s=[];let n=0;w.content=L.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:S,shapeColor:w}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=VH({},A,uW(b,void 0,{})),{width:s,height:n,text:r}=jG(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=VH({},k,uW(x,void 0,{})),{width:e,height:s,text:n}=jG(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},e=null!=d?d:w;S?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,T.shape=t;const i=null!=f?f:M.size;o=Math.max(i,o),s.push(i)}else T.shape={visible:!1};return T.height=o,n+=o,aK.autoWidth&&!1!==K.multiLine;if(V){K=VH({},S,uW(U,void 0,{})),X()&&(K.multiLine=null===(r=K.multiLine)||void 0===r||r,K.maxWidth=null!==(a=K.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=jG(G,K);w.title.value=Object.assign(Object.assign({width:X()?Math.min(e,null!==(o=K.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},K),{text:t}),z=w.title.value.width,H=w.title.value.height,N=H+(O?w.title.spaceRow:0)}return P+=N,B+=N,w.title.width=z,w.title.height=H,X()?E+=R||z:E+=Math.max(z,R),O&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-j-I-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=P,w.panelDomHeight=B,w})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:s,canvasY:n}=t.event;const{tooltipSpec:r}=t,a={x:1/0,y:1/0},o="canvas"===r.renderMode,l=this._getParentElement(r);let h={x:0,y:0},c={x:0,y:0},d=1,u=1;if(Ix(this._env)&&!r.confine&&!o){c=null!==(e=null==l?void 0:l.getBoundingClientRect())&&void 0!==e?e:a;const t=null!==(i=this._compiler.getCanvas())&&void 0!==i?i:this._chartContainer,s=null==t?void 0:t.getBoundingClientRect();h={x:s.x-c.x,y:s.y-c.y},d=FG(t,s),u=FG(l,c)}return s*=d,n*=d,Ix(this._env)&&(s+=h.x,n+=h.y),s/=u,n/=u,{x:s,y:n}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:s=0,y:n}=this._cacheTooltipPosition,r=this._getPointerPositionRelativeToTooltipParent(t);if(Qt(r,{x1:s,y1:n,x2:s+e,y2:n+i},!1))return!0;const a={x:s,y:n},o={x:a.x+e,y:a.y},l={x:a.x,y:a.y+i},h={x:o.x,y:l.y},c=this._cachePointerPosition;return oe([c,a,o],r.x,r.y)||oe([c,l,h],r.x,r.y)||oe([c,a,h],r.x,r.y)||oe([c,o,l],r.x,r.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}zW.specKey="tooltip";const HW=(t,e)=>p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",NW=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let VW;const GW=(t=document.body)=>{if(u(VW)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),VW=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return VW};function WW(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:f="left"}=null!=t?t:{},{fill:m,shadow:v,shadowBlur:y,shadowColor:_,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:M=0,width:w=0}=n,{value:T={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=VH({},e,t),s={};return s.width=HW(i),s}(C),R=UW(E),L=UW(P),{bottom:O,left:I,right:D,top:F}=dH(h),j="right"===f?"marginLeft":"marginRight";return{align:f,panel:{width:HW(w+2*M),minHeight:HW(g+2*M),paddingBottom:HW(O),paddingLeft:HW(I),paddingRight:HW(D),paddingTop:HW(F),borderColor:k,borderWidth:HW(M),borderRadius:HW(A),backgroundColor:m?`${m}`:"transparent",boxShadow:v?`${b}px ${x}px ${y}px ${S}px ${_}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?HW(null==r?void 0:r.spaceRow):"0px"},UW(VH({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return YW.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=YW.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==Ox?void 0:Ox.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(YW.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}YW.type="tooltipModel";const KW={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},XW={boxSizing:"border-box"},$W={display:"inline-block",verticalAlign:"top"},qW={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},ZW={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},JW={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},QW={lineHeight:"normal",boxSizing:"border-box"};class tU extends YW{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let f="currentColor";const m=()=>c?e(c):f,v=NW(u),_=t=>new em({symbolType:t,size:v,fill:!0});let b=_(l);const x=b.getParsedPath();x.path||(b=_(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==p){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||y(h)||d)return f=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){f=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class eU extends YW{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const iU={overflowWrap:"normal",wordWrap:"normal"};class sU extends YW{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=K(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=K(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(VH({},$W,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e)=>{var i,s;const{key:r,isKeyAdaptive:o}=t,{height:l}=a[e],{keyColumn:h}=n,c=VH({},o?ZW:qW,Object.assign(Object.assign(Object.assign({height:HW(l)},iU),h.common),null===(i=h.items)||void 0===i?void 0:i[e]));return y(r)&&""!==(null===(s=null==r?void 0:r.trim)||void 0===s?void 0:s.call(r))||S(r)||c.visibility?c.visibility="visible":c.visibility="hidden",c};r.forEach(((t,e)=>{var i;"key-box"===this.className?this.children[e].setStyle(o(t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e)=>{var i;const{height:s}=a[e],{valueColumn:r}=n;return VH({},JW,Object.assign(Object.assign(Object.assign({height:HW(s)},iU),r.common),null===(i=r.items)||void 0===i?void 0:i[e]))})(0,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e)=>{var i,s,r,l;const{height:h}=a[e],{shapeColumn:c}=n,d=o(t,e),u=`calc((${null!==(s=null!==(i=d.lineHeight)&&void 0!==i?i:d.fontSize)&&void 0!==s?s:"18px"} - ${null!==(r=c.width)&&void 0!==r?r:"8px"}) / 2)`;return VH({},QW,Object.assign(Object.assign({height:HW(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[e]))})(t,e),this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[];n.forEach(((t,e)=>{var i,s,n,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=y(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||S(a)?a:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(n=r[e].key)||void 0===n?void 0:n.multiLine)}else if("value-box"===this.className){const i=t.value;c=y(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,s;const n=this._option.getTooltipStyle(),r=Object.assign(Object.assign({},n.shapeColumn),null===(i=n.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:r.width,fill:null!==(s=t.shapeFill)&&void 0!==s?s:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class nU extends YW{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new sU(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(VH(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+NW(e)),0);return Object.assign(Object.assign({},t),{width:`${a+GW(this._option.getContainer())}px`,maxHeight:HW(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class rU extends YW{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new tU(this.product,this._option,t);e.init(),this.shape=e,this.children[e.childIndex]=e}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(t=1){const e=new eU(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(VH({},KW,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeColor,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeColor,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const aU="99999999999999";class oU extends YW{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:aU,fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new rU(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new nU(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(VH({},XW,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const lU=t=>{MN.registerComponentPlugin(t.type,t)};class hU extends zW{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(hU.type),this.type=LW.dom,this._tooltipContainer=null==Ox?void 0:Ox.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Ox&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;const{tooltipActual:n,tooltipSpec:r}=e;if(t&&this.model){if(!e.changePositionOnly){this._tooltipActual=n,this._initStyle();const t=!this.model.product;this.model.initAll(),t&&this._initEvent(this.model.product),this.model.setStyle(),this.model.setContent()}this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=n.position)&&void 0!==i?i:{};if(r.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),r.updateElement(a,n,e);const i=this._getActualTooltipPosition(n,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=WW(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}_initEvent(t){t.addEventListener("pointerleave",(t=>{const{renderMode:e,enterable:i}=this._component.getSpec(),s=t.relatedTarget;"html"===e&&i&&(u(s)||s!==this._compiler.getCanvas()&&!pe(s,this.getTooltipContainer()))&&this._component.hideTooltip()}))}}hU.type=LW.dom;class cU extends zW{constructor(){super(cU.type),this.type=LW.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new eR({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{tooltipActual:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}cU.type=LW.canvas;const dU=()=>{lU(cU)},uU=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},pU={min:t=>t.length?U(t.map((t=>1*t))):0,max:t=>t.length?W(t.map((t=>1*t))):0,"array-min":t=>t.length?U(t.map((t=>1*t))):0,"array-max":t=>t.length?W(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}},gU=(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=cN([],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 fU(a,n,o)},fU=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Hx(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=>{Hx(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=pU[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},mU=(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=>{Hx(t[e])||(t[e]=0)}))})),t};class vU extends JV{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const yU=`${gL}_HIERARCHY_DEPTH`,_U=`${gL}_HIERARCHY_ROOT`,bU=`${gL}_HIERARCHY_ROOT_INDEX`;function xU(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function SU(t,e,i){t&&(i.needDefaultSeriesField&&(t[Dj]=i.defaultSeriesField),t[Oj]=e,t[Ij]=i.getKey(t,e,i))}function AU(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function kU(t,e,i,s=0,n,r){void 0===r&&(r=e),SU(t,e,i),t[yU]=s,t[_U]=n||t[i.categoryField],t[bU]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>kU(e,s,i,t[yU]+1,t[_U],r)))}const MU=["appear","enter","update","exit","disappear","normal"];function wU(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 BU(n)&&delete n.type,n.oneByOne&&(n=CU(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:EU,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=VH({},o[e],a);return BU(n)&&delete n.type,n.oneByOne&&(n=CU(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:EU,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function TU(t,e,i){var s,n,r,a,o;const l={};return p(e.animationAppear)&&(l.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(l.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(l.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(l.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(l.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),e.animationNormal&&e.animationNormal[t]&&(l.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=B(t),RU(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(l,i)}function CU(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function EU(t,e){var i,s;return null!==(i=null==t?void 0:t[Oj])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function PU(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 BU(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function RU(t,e){if(_(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),RU(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),RU(t[i],e)}class LU extends IV{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=V(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=Uz(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=YH(P(a,`series.${h}`),h,l,o),d=P(a,`series.${h}_${r}`);return VH({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?P(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n,r){if(!t)return;V(t[i]).forEach((i=>{i&&i.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:null!=n?n:t.animation},i),{getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=VH({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>VH({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class OU extends DV{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${gL}_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=LU,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=0,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=function(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getProgressiveConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(JN(this._rawData.dataSet,"invalidTravel",mU),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i,s;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=lV(n,this._dataSet,this._option.sourceDataList,{onError:null===(e=this._option)||void 0===e?void 0:e.onError})),null===(s=null===(i=this._rawData)||void 0===i?void 0:i.target)||void 0===s||s.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=oV(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=oV(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new vU(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];i&&i.lockStatisticsByDomain&&i.domain?(this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=U(i.domain),this._rawStatisticsCache[t].max=W(i.domain)):this._rawStatisticsCache[t].values=i.domain):this._rawStatisticsCache[t]=fU(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=U(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=W(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){JN(this._dataSet,"dimensionStatistics",gU);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Mr(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&&cN(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){JN(this._dataSet,"dimensionStatistics",gU);const s=new Mr(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=cN(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&cN(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Mr(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)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(JN(this._rawData.dataSet,"addVChartProperty",uU),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:xU.bind(this),call:SU}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:null==t?void 0:t.customShape,componentType:t.componentType,depend:n.depend,key:t.dataKey});if(a){if(n.hasAnimation){const e=wU({},TU(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Dx(s)||Fx(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=VH(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=VH(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:gV.STATE_HOVER_REVERSE,highlightState:gV.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:gV.STATE_SELECTED_REVERSE,state:gV.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:Dj;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:Fj,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,Fj)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new SW(this)}_compareSpec(t,e,i){var s,n;const r=super._compareSpec(t,e),a=Object.keys(e||{}).sort();return z(a,Object.keys(t||{}).sort())?((i=null!=i?i:{data:!0}).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(V(t.extensionMark).length!==V(e.extensionMark).length||(null===(s=e.extensionMark)||void 0===s?void 0:s.some(((e,i)=>e.type!==t.extensionMark[i].type||e.id!==t.extensionMark[i].id))))&&(r.reMake=!0),r.reMake?r:((null===(n=e.extensionMark)||void 0===n?void 0:n.some(((e,i)=>e.visible!==t.extensionMark[i].visible)))&&(r.reCompile=!0),this._marks.getMarks().some((s=>{var n,r;return i[s.name]=!0,(null===(n=e[s.name])||void 0===n?void 0:n.visible)!==(null===(r=t[s.name])||void 0===r?void 0:r.visible)}))&&(r.reCompile=!0),a.some((s=>!i[s]&&!z(t[s],e[s])))?(r.reMake=!0,r):r)):(r.reMake=!0,r)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Mr||hV(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:Dj,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new iH).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return Xz(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:Dj}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,s,n,r;const{key:a,groupKey:o,skipBeforeLayouted:l,themeSpec:h={},markSpec:d,dataView:g,dataProductId:f,parent:m,isSeriesMark:v,depend:y,progressive:_,support3d:b=this._spec.support3d||!!this._spec.zField,morph:x=!1,clip:S,customShape:A,stateSort:k,noSeparateStyle:M=!1}=e,w=super._createMark(t,{key:null!=a?a:this._getDataIdKey(),support3d:b,seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:M});if(p(w)){this._marks.addMark(w,{name:t.name}),v&&(this._seriesMark=w),u(m)?null===(i=this._rootMark)||void 0===i||i.addMark(w):!1!==m&&m.addMark(w),u(g)?(w.setDataView(this.getViewData(),this.getViewDataProductId()),w.setSkipBeforeLayouted(!0)):!1!==g&&w.setDataView(g,f),c(l)&&w.setSkipBeforeLayouted(l),p(y)&&w.setDepend(...V(y));const a=this.getSpec()||{};w.setMorph(x),w.setMorphKey((null===(s=a.morph)||void 0===s?void 0:s.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`),w.setMorphElementKey(null!==(r=null===(n=a.morph)||void 0===n?void 0:n.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),u(_)||w.setProgressiveConfig(_),u(o)||w.setGroupKey(o),A&&w.setCustomizedShapeCallback(A),k&&w.setStateSortCallback(k),S&&w.setClip(S),this.initMarkStyleWithSpec(w,VH({},h,d||a[w.name]))}return w}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:Ij}_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!==Nj&&t!==Gj&&t!==Hj&&t!==Vj||(t=this.getStackValueField()),null!==(e=uN(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=Wz[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Hx(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:Dj]}}function IU(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();mR(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 DU(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}}}OU.mark=nz,OU.transformerConstructor=LU;class FU extends OU{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=V(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=V(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&V(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);mR(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:`${gL}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?V(this._spec.xField)[0]:V(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(Nj),this.setFieldX2(Hj)):(this.setFieldY(Nj),this.setFieldY2(Hj))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(Gj),this.setFieldX2(Vj)):(this.setFieldY(Gj),this.setFieldY2(Vj))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(Uj),this.setFieldX2(Wj)):(this.setFieldY(Uj),this.setFieldY2(Wj))}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=V(this._spec.xField),this._specYField=V(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(V(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(V(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)&&(IU("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const jU="monotone",zU="linear";class HU{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(dz.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t,customShape:null===(i=this._spec.line)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.line)||void 0===s?void 0:s.stateSort}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:zU,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===jU?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(dz.point,{morph:PU(this._spec,dz.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:i.customShape,stateSort:i.stateSort})),!0===this._spec.activePoint){const t=new Mr(this._option.dataSet,{name:`${gL}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),customShape:i.customShape,stateSort:i.stateSort}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(YN.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:gV.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[dz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(YN.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,VH({},this._spec[dz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:gV.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.getProduct()&&e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}class NU extends eG{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(vR(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class VU extends NU{constructor(){super(...arguments),this.type=VU.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)===uL.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}VU.type="line";const GU=()=>{MN.registerMark(VU.type,VU),Jw(),Vw(),EO.registerGraphic(FL.line,rm),gG()};class WU extends eG{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class UU extends WU{constructor(){super(...arguments),this.type=UU.type}}UU.type="symbol";const YU=()=>{MN.registerMark(UU.type,UU),RD()};class KU extends LU{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class XU extends vG{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function $U(t,e,i,s){switch(t){case r.cartesianBandAxis:return XG(ON(i,["z"]),"band",e);case r.cartesianLinearAxis:return XG(ON(i,["z"]),"linear",e);case r.cartesianLogAxis:return XG(ON(i,["z"]),"log",e);case r.cartesianSymlogAxis:return XG(ON(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return XG(ON(i),void 0,e);case r.polarBandAxis:return $G(i.orient,"band",e);case r.polarLinearAxis:return $G(i.orient,"linear",e);case r.polarAxis:return $G(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=V(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=NG(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>BN(t.orient)));let d;d=p(c)?VH({},qG(c.type)?a:o,l):l;const u=n.find((t=>RN(t.orient)));let g;return g=p(u)?VH({},yR(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=V(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=NG(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?VH({},qG(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?VH({},yR(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return qU(i,NG(t,e));default:return NG(t,e)}}const qU=(t,e)=>{var i;const s=VH({},e,e[IN(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class ZU extends IV{getTheme(t,e){return $U(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({},dH(e)),{[s]:0}))}}class JU extends jV{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 XU(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=ZU,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof Dd||this.event.emit(s,{model:this,node:e,event:i,item:n,datum:r,source:t.Event_Source_Type.chart,chart:null===(o=null===(a=this._option)||void 0===a?void 0:a.globalInstance)||void 0===o?void 0:o.getChart()},"model")},this._option.animation&&(this.animate=new OV({getCompiler:i.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!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&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}JU.transformerConstructor=ZU;class QU extends eG{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(FL.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}QU.type="component";const tY=()=>{MN.registerMark(QU.type,QU)},eY=t=>t;class iY extends JU{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return V(null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem())}created(){var e,i,s,n,r,a,o,l,h,d,u,g,f,m,v,y,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=b,b.setZIndex(this.layoutZIndex),p(this._spec.id)&&b.setUserId(this._spec.id),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?NL.circleAxisGrid:NL.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});e.setZIndex(null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:t.LayoutZIndex.Axis_Grid),e.setInteractive(!1),this._marks.addMark(e),this._gridMark=e}if(c(this._spec.interactive)&&this._marks.forEach((t=>t.setInteractive(this._spec.interactive))),!1!==this._option.animation&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=wU(null===(o=MN.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(u=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==u?u: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!==(_=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_: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());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new JV(this._option,t)]}collectData(t,e){const i=[];return cR(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=_(r)?mR(this._scale.type)?r:[r[0]]:[r],t||(this._dataFieldText=s.getFieldAlias(r[0])),r){const t=s.getViewData();if(e)r.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const t=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s);r.forEach((e=>{var s;(null===(s=null==t?void 0:t.latestData)||void 0===s?void 0:s[e])&&i.push(t.latestData[e])}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return cR(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=V(t)),p(i)&&(this._regionUserId=V(i)),p(e)&&(this._seriesIndex=V(e)),p(s)&&(this._regionIndex=V(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=dR(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()})),cR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(e){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(e)}computeData(t){!this._tickData||!this._tickData.length||"force"!==t&&z(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()}))}initScales(){this._scales=[this._scale];const t=[];if(cR(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=W(t.map((t=>t.fields.length)));for(let t=1;tthis._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=SN(s=t.domainLine)).startSymbol=SN(s.startSymbol),s.endSymbol=SN(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=D(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 kN(VH({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:kN(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=>{d(t[i])?e[i]=(e,s,n,r)=>kN(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=kN(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return kN(VH({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:kN(t.tick.style)),t.tick.state&&(i.tick.state=AN(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 kN(VH({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:kN(t.subTick.style)),t.subTick.state&&(i.subTick.state=AN(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=GG[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Tt(p):null,textStyle:VH({},d,kN(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:kN(h.style)}),h.state&&(i.title.state.shape=AN(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:kN(o.style)}),o.state&&(i.title.state.background=AN(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=AN(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=kN(t.background.style)),t.background.state&&(i.panel.state=AN(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return kN(VH({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:kN(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:kN(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=VG(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){QN(this._option.dataSet,"scale",eY),JN(this._option.dataSet,"ticks",JE);return new Mr(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}iY.specKey="axes";const sY=()=>{EO.registerGraphicComponent(HL.lineAxis,((t,e)=>new cE(t,e))),EO.registerGraphicComponent(HL.circleAxis,(t=>new gE(t))),EO.registerComponent(jL.axis,QD),EO.registerGraphicComponent(NL.lineAxisGrid,((t,e)=>new sP(t,e))),EO.registerGraphicComponent(NL.circleAxisGrid,((t,e)=>new rP(t,e))),EO.registerComponent(jL.grid,iF),tY(),MN.registerAnimation("axis",(()=>({appear:{custom:mE},update:{custom:fE},exit:{custom:Mu}})))},nY=[DG];class rY extends iY{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),cR(this._regions,(t=>{const e=this.getOrient();BN(e)?t.setXAxisHelper(this.axisHelper()):RN(e)?t.setYAxisHelper(this.axisHelper()):LN(e)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=VH({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(VH({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=BN(this.getOrient()),n=t=>{var e;return(s?!BN(t.getOrient()):BN(t.getOrient()))&&mR(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&t.getScale().domain()[1]>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=ON(i,["z"]),LN(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(!YG(e))return null;const{axisType:t,componentName:s}=DN(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=>RN(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(!YG(t))return;const{axisType:s,componentName:n}=DN(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=MN.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:s,right:n,top:r,bottom:a}=this._innerOffset;let o=[];BN(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):LN(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n],this._scale.range(o)):k(i)&&(o=this._inverse?[r,i-a]:[i-a,r]);const[l,h]=this._scale.range();return o[0]===l&&o[1]===h||(t=!0,this._scale.range(o)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(nY.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){BN(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&&!BN(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!LN(this.getOrient())&&this._spec.innerOffset){const t=this._spec;RN(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=hH(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=hH(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=BN(this.getOrient())?t.fieldX:LN(this.getOrient())?t.fieldZ:t.fieldY,mR(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFlush:null===(i=this._spec.label)||void 0===i?void 0:i.flush})}axisHelper(){return{isContinuous:mR(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(BN(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(i.getGroupGraphicItem()),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=BN(this._orient)?{x:W(this._scale.range())+t,y:e}:{x:t,y:U(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return cR(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]:BN(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:LN(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();cR(this._regions,(e=>{BN(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):RN(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):LN(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=BN(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=BN(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=VH(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}}),o=e.getBoundsWithoutRender(s);a=!0,this._latestBounds=o,isFinite(o.width())&&(i=this._appendAxisUnit(o,n))}return i}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return ZG(e.value,i)})).filter((t=>t.value>=0&&t.value<=1))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const{min:i,max:s}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?s:Math.max(e[1],s)})):(e[0]=0,e[1]=0),this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=UG(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(U(t)-W(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=aY?10:n>=oY?5:n>=lY?2:1)*Math.pow(10,s),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=t[1]&&(t[1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(t[1]-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}}class cY extends rY{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new aL}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}cY.type=r.cartesianLinearAxis,cY.specKey="axes",N(cY,hY);const dY=()=>{sY(),MN.registerComponent(cY.type,cY)};class uY{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=V(e).concat(i);if(n.push(r),o){const e=ZG(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=>ZG(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class pY extends rY{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new zR}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=PR(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{sY(),MN.registerComponent(pY.type,pY)};class fY extends cY{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),cR(this._regions,(t=>{BN(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=VH({},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 Mr(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new JV(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=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,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=>ZG(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=>ZG(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}fY.type=r.cartesianTimeAxis,fY.specKey="axes";class mY extends cY{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new hL}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}transformScaleDomain(){}}mY.type=r.cartesianLogAxis,mY.specKey="axes",N(mY,hY);class vY extends cY{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new cL}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}vY.type=r.cartesianSymlogAxis,vY.specKey="axes",N(vY,hY);class yY extends FU{constructor(){super(...arguments),this.type=uL.line,this.transformerConstructor=KU,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(wU(null===(i=MN.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),TU("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=DU(this);this._symbolMark.setAnimationConfig(wU(null===(s=MN.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),TU("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}yY.type=uL.line,yY.mark=uz,yY.transformerConstructor=KU,N(yY,HU);class _Y{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=V(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{hV(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Mr)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){var i,s;if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));return e[0]?e[0]:(null===(i=this._onError)||void 0===i||i.call(this,`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._dataArr[e]?this._dataArr[e]:(null===(s=this._onError)||void 0===s||s.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class bY{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)=>{Nx(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{cN(e,[{key:t,operations:mR(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&&cN(e,[{key:i.field,operations:mR(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?nH("colorOrdinal"):nH(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Nx(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(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;s.range&&!z(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Nx(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(!Nx(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=mR(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=mR(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;mR(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(mR(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=mR(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)));mR(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 xY{constructor(t){this.stackRegion=({model:t})=>{const e=t.getSeries(),i=e.some((t=>t.getStack()));if(!i)return;const s=e.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),n=s||e.some((t=>t.getPercent())),r=e.some((t=>t.getStackOffsetSilhouette())),a=pN(t,!0);for(const e in a)for(const i in a[e].nodes)vN(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)mN(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&fN(a[i],s)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class SY extends EV{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=zx(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:fL,height:mL},this._viewRect={width:fL,height:mL},this._viewBox={x1:0,y1:0,x2:fL,y2:mL},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)=>V(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=dH(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new XN(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new _Y(this._dataSet,null===(s=this._option)||void 0===s?void 0:s.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(r=this._option)||void 0===r?void 0:r.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._spec.background&&"object"==typeof this._spec.background&&this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),this._canStack&&(this._stack=new xY(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=D(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=MN.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},t),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})))}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=MN.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(e){var i,s,n,r;if(null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeLayoutWithSceneGraph)||void 0===s||s.call(i),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(e);const i=this.getLayoutElements();this._layoutFunc(this,i,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:i,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(e),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===r||r.call(n)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof DV)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 eG))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof eG)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){V(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),V(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&hV(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=bV(this._spec,this._option,{width:fL,height:mL})),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)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=Xz(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new bY(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){xV(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=Xz(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),s=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(s))return e.reMake=!0,e;for(let s=0;s{xV(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};_(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,xV(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):xV(t,i.updateSpec(a))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];xV(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=cH(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(gV.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(gV.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearSelected(){this.clearState(gV.STATE_SELECTED)}clearHovered(){this.clearState(gV.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((e=>{this._event.on(e,(({value:e})=>{this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)};this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,i)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?V(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=s;if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===YN.dimensionHover||s===YN.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>yR(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const AY=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=V(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return V(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class kY{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);FH(t,r,l.spec),FH(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o}));FH(s,null!=a?a:r,Object.assign(Object.assign({},i),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=AY(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=AY(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=V(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return V(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(MN.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(MN.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=MN.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=MN.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=MN.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),null===(a=null==u?void 0:u.getSpecInfo(t,i))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))})),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(V(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(V(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class MY extends kY{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;"top"!==s&&"bottom"!==s||(e.x=!0),"left"!==s&&"right"!==s||(e.y=!0),"z"===s&&(e.z=!0),P(i,"trimPadding")&&VH(i,SV(this.type,t))})),e.x||t.axes.push({orient:"bottom"}),e.y||t.axes.push({orient:"left"}),t.zField&&!e.z&&t.axes.push({orient:"z"})}}}class wY extends MY{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),_V(t)}}class TY extends SY{constructor(){super(...arguments),this.transformerConstructor=wY,this.type="line",this.seriesType=uL.line,this._canStack=!0}}TY.type="line",TY.seriesType=uL.line,TY.transformerConstructor=wY;class CY extends NU{constructor(){super(...arguments),this.type=CY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}CY.type="area";const EY=()=>{MN.registerMark(CY.type,CY),Jw(),Rw(),EO.registerGraphic(FL.area,Tm),gG()};class PY extends SW{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of V(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 BY=()=>{MN.registerAnimation("area",uG),pG(),cG()};class RY extends KU{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=VH({},f.style,g.style),l.state=VH({},f.state,g.state),d||(l.style.fill=!1),u||(l.style.stroke=!1),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),l.visible=!(!d&&!u),t.area=l,t.line=h}}class LY extends FU{constructor(){super(...arguments),this.type=uL.area,this.transformerConstructor=RY,this._sortDataByAxis=!1}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},s=this._spec.area||{},n=!1!==s.visible&&!1!==(null===(t=s.style)||void 0===t?void 0:t.visible),r=null!==(e=this._spec.seriesMark)&&void 0!==e?e:"area";this._areaMark=this._createMark(LY.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:i,isSeriesMark:n&&"point"!==r,customShape:s.customShape,stateSort:s.stateSort}),this.initSymbolMark(i,"point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===jU?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;l&&("horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return rH(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return rH(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)})))}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(wU(null===(e=MN.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),TU("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(wU(null===(i=MN.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),TU("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=DU(this);this._symbolMark.setAnimationConfig(wU(null===(s=MN.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),TU("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new PY(this);const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}LY.type=uL.area,LY.mark=gz,LY.transformerConstructor=RY,N(LY,HU);class OY extends MY{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),_V(t)}}class IY extends SY{constructor(){super(...arguments),this.transformerConstructor=OY,this.type="area",this.seriesType=uL.area,this._canStack=!0}}IY.type="area",IY.seriesType=uL.area,IY.transformerConstructor=OY;function DY(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 FY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:DY(t,e)}),jY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:DY(t,e)}),zY={type:"fadeIn"},HY={type:"growCenterIn"};function NY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return zY;case"scaleIn":return HY;default:return FY(t)}}class VY extends eG{constructor(){super(...arguments),this.type=VY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}VY.type="rect";const GY=()=>{MN.registerMark(VY.type,VY),PD(),CD.useRegisters([sj,nj,rj,aj,ej,ij])};function WY(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[rz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):rH(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[az]):rH(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[oz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):rH(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[lz]):rH(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(i),this._barMark=this._createMark(Object.assign(Object.assign({},KY.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:PU(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:i,customShape:null===(t=this._spec.bar)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort})}_initBarBackgroundMark(t){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(KY.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:this._spec.barBackground.customShape,stateSort:this._spec.barBackground.stateSort}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(JN(this._option.dataSet,"addVChartProperty",uU),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};JN(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Mr(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:xU.bind(this),call:SU}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new vU(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=lz,s=oz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=az,s=rz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=pN(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)WY(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e){var i,s;let n,r,a;e?(n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=null===(s=(i=this[a]).getScale)||void 0===s?void 0:s.call(i,0),l=this[a].isInverse(),h=this._spec.barMinHeight,c=rH(this[n](t),o),d=rH(this[r](t),o);let u=Math.abs(c-d);uthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setClip((()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[Hj],n=t[Nj],r=t[Vj],h=t[Gj];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]),{[Hj]:i,[Nj]:s}),a?{[Vj]:o,[Gj]:l}:void 0);t.push(lm(Object.assign(Object.assign({},"horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)}),{cornerRadius:this._spec.stackCornerRadius,fill:!0})))})),t}))}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>rH(this._dataToPosY(t),a),y1:t=>rH(this._dataToPosY1(t),a)}:{y:t=>rH(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>rH(this._dataToPosX(t),r),x1:t=>rH(this._dataToPosX1(t),r)}:{x:t=>rH(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=DU(this);this._barMark.setAnimationConfig(wU(null===(e=MN.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),TU(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6;if(void 0!==this._spec.barWidth&&r===n)return pH(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,pH(this._spec.barMinWidth,a))),l&&(h=Math.min(h,pH(this._spec.barMaxWidth,a))),h}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),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,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=V(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=pH(null!==(l=i[r-1])&&void 0!==l?l:G(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*y+(u-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=mR(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}KY.type=uL.bar,KY.mark=hz,KY.transformerConstructor=YY;const XY=()=>{yF(),GY(),MN.registerAnimation("bar",((t,e)=>({appear:NY(t,e),enter:FY(t,!1),exit:jY(t,!1),disappear:jY(t)}))),gY(),dY(),MN.registerSeries(KY.type,KY)};class $Y extends MY{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),_V(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 qY extends SY{constructor(){super(...arguments),this.transformerConstructor=$Y,this.type="bar",this.seriesType=uL.bar,this._canStack=!0}}qY.type="bar",qY.seriesType=uL.bar,qY.transformerConstructor=$Y;class ZY extends eG{constructor(){super(...arguments),this.type=ZY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}ZY.type="rect3d";class JY extends KY{constructor(){super(...arguments),this.type=uL.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}JY.type=uL.bar3d,JY.mark=cz;class QY extends $Y{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class tK extends qY{constructor(){super(...arguments),this.transformerConstructor=QY,this.type="bar3d",this.seriesType=uL.bar3d}}tK.type="bar3d",tK.seriesType=uL.bar3d,tK.transformerConstructor=QY;const eK=[10,20],iK=gR.Linear,sK="circle",nK=gR.Ordinal,rK=["circle","square","triangle","diamond","star"],aK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class oK extends LU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class lK extends FU{constructor(){super(...arguments),this.type=uL.scatter,this.transformerConstructor=oK,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(_(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=`${gL}_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=`${gL}_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:y(e)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:iK,defaultRange:eK},"size")}getShapeAttribute(t,e){return u(e)?sK:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:nK,defaultRange:rK},"shape")}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(lK.mark.point,{morph:PU(this._spec,lK.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:i,isSeriesMark:!0,customShape:null===(t=this._spec.point)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.point)||void 0===e?void 0:e.stateSort})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=DU(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(wU(null===(i=MN.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),TU("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:y(this._shape)||d(this._shape)?this._shape:sK},gV.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},gV.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},gV.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},gV.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},gV.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}lK.type=uL.scatter,lK.mark=pz,lK.transformerConstructor=oK;const hK=()=>{YU(),MN.registerAnimation("scatter",((t,e)=>Object.assign({appear:aK(0,e)},lG))),gY(),dY(),MN.registerSeries(lK.type,lK)};class cK extends MY{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class dK extends SY{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="scatter",this.seriesType=uL.scatter,this._canStack=!0}}dK.type="scatter",dK.seriesType=uL.scatter,dK.transformerConstructor=cK;Ns();const uK={},pK=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function gK(t,e){t&&Sa(t)||Wx("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(uK[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Ns().projection(s),s.copy=s.copy||function(){const t=i();return pK.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),uK[i]||null}const fK={albers:on,albersusa:function(){var t,e,i,s,n,r,a=on(),o=an().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=an().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(fK).forEach((t=>{gK(t,fK[t])}));const mK="Feature",vK="FeatureCollection";function yK(t){const e=$a(t);return 1===e.length?e[0]:{type:vK,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===vK?t.features:$a(t).filter((t=>!ma(t))).map((t=>t.type===mK?t:{type:mK,geometry:t}))}(e))),[])}}const _K=pK.concat(["pointRadius","fit","extent","size"]);function bK(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{_K.includes(s)&&(i=i.concat(mO(t[s],e)))})),i):i}let xK=class extends tI{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return ma(this.spec.pointRadius)||this.detach(mO(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(mO(t,this.view)),this.commit(),this}size(t){return ma(this.spec.size)||this.detach(mO(this.spec.size,this.view)),this.spec.size=t,this.attach(mO(t,this.view)),this.commit(),this}extent(t){return ma(this.spec.extent)||this.detach(mO(this.spec.extent,this.view)),this.spec.extent=t,this.attach(mO(t,this.view)),this.commit(),this}fit(t){return ma(this.spec.fit)||this.detach(mO(this.spec.fit,this.view)),this.spec.fit=t,this.attach(mO(t,this.view)),this.commit(),this}configure(t){return this.detach(bK(this.spec,this.view)),ma(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(bK(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=gK((t||"mercator").toLowerCase());return e||Wx("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),pK.forEach((t=>{ma(this.spec[t])||function(t,e,i){fa(t[e])&&t[e](i)}(this.projection,t,yO(this.spec[t],e,gK))})),ma(this.spec.pointRadius)||this.projection.path.pointRadius(yO(this.spec.pointRadius,e,gK)),!(ma(this.spec.fit)||ma(this.spec.extent)&&ma(this.spec.size))){const t=yK(yO(this.spec.fit,e,gK));this.spec.extent?this.projection.fitExtent(yO(this.spec.extent,e,gK),t):this.spec.size&&this.projection.fitSize(yO(this.spec.size,e,gK),t)}return this.projection}output(){return this.projection}};const SK=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class AK extends OU{constructor(){super(...arguments),this.type=uL.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=`${gL}_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 kK=`${gL}_MAP_LOOK_UP_KEY`,MK=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[Oj]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[kK]=e.nameMap[n]:t[kK]=n})),t.features);class wK extends SW{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 TK extends eG{constructor(){super(...arguments),this.type=TK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}TK.type="path";const CK=()=>{MN.registerMark(TK.type,TK),ED()};class EK{constructor(t){this.projection=gK(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 PK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class BK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function RK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:PK}:Dx(e)||Fx(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:BK}:null}const LK={debounce:dt,throttle:ut};class OK{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=Dx(this._renderMode)||Fx(this._renderMode),RK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return RK(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a}=s;u(n)||Qt({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,LK[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,LK[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||RK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||RK(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:Qt({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(e,i,s,n){var r,a;const o=null!==(r=null==n?void 0:n.delayType)&&void 0!==r?r:"throttle",l=null!==(a=null==n?void 0:n.delayTime)&&void 0!==a?a:0,h=this._isGestureListener?this._gestureController:e,c=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:t.Event_Bubble_Level.chart,consume:!0}],d=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:t.Event_Bubble_Level.chart,consume:!1}];h.on(...d,LK[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,LK[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){RK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||RK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(e,i,s,n){e.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.chart},(t=>{if(!t.event)return;const{event:e}=t;Qt({x:e.canvasX,y:e.canvasY},this._getRegionOrSeriesLayout(i),!1)&&this._handleDrag(t,s,n)})),e.on("click",{level:t.Event_Bubble_Level.chart},(()=>!this._clickEnable))}initDragEventOfSeries(e,i,s){this._option.disableTriggerEvent||RK(this._renderMode)&&e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,i,s)}))}initDragEventOfRegions(e,i,s,n){this._option.disableTriggerEvent||RK(this._renderMode)&&e.forEach((e=>{i?e.getSeries().forEach((e=>{i(e)&&(e.event.on(this._getZoomTriggerEvent("start"),{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(t=>{this._handleDrag(t,s)})),e.event.on("click",{level:t.Event_Bubble_Level.model,filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,e,s,n)}))}_handleDrag(e,i,s){var n,r,a;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(e.event))return;const o=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",l=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,h=null===(a=null==s?void 0:s.realTime)||void 0===a||a,c=this._getZoomTriggerEvent("move"),d=this._getZoomTriggerEvent("end"),u=e.event;let p=u.canvasX,g=u.canvasY,f=u.canvasX,m=u.canvasY;const v=LK[o]((e=>{this._clickEnable=!0;const s=e.event,n=[s.canvasX-f,s.canvasY-m];f=s.canvasX,m=s.canvasY,!h&&i&&i(n,e.event),this._eventObj.emit("panend",{delta:n,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},y),this._eventObj.off(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.window},v)}),l),y=LK[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const e=t.event,s=[e.canvasX-p,e.canvasY-g];p=e.canvasX,g=e.canvasY,h&&i&&i(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),l);this._eventObj.on(c,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},y),this._eventObj.on(d,{level:t.Event_Bubble_Level.chart,source:t.Event_Source_Type.chart},v)}}function IK(t,e){return`${gL}_${e}_${t}`}class DK extends JU{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:IK(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=VH(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,model:this})}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new EK(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===uL.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),cR(this._regions,(t=>{var e;if(t.type===uL.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Rt})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===uL.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[kK],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}DK.type=r.geoCoordinate,N(DK,OK);const FK=()=>{MN.registerComponent(DK.type,DK)};class jK extends LU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class zK extends AK{constructor(){super(...arguments),this.type=uL.map,this.transformerConstructor=jK,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 !`),tV.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),JN(this._dataSet,"copyDataView",aV),JN(this._dataSet,"map",MK),JN(this._dataSet,"lookup",SK);const i=tV.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Mr(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:cV.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:kK,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 vU(this._option,s)}initMark(){this._pathMark=this._createMark(zK.mark.area,{morph:PU(this._spec,zK.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:Dj])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:Dj]):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(wU(null===(t=MN.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),TU("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new wK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[Oj]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[Oj],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Rt}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new Rt}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return Oj}getActiveMarks(){return[this._pathMark]}}zK.type=uL.map,zK.mark=_z,zK.transformerConstructor=jK;const HK=()=>{EO.registerGrammar("projection",xK,"projections"),FK(),CK(),MN.registerSeries(zK.type,zK),MN.registerImplement("registerMap",sV),MN.registerImplement("unregisterMap",nV),dG()},NK=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[Xj]=!0:delete t[Xj]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=VK([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}=GK(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=St(y,e)):(t[c]=+_,_=St(_,e)),t[d]=St(t[c],e),m=St(m,e),b=At(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=St(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=VK(a,t,n,r,h,l,i,e),r.push(n)})),r};function VK(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}=GK(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=St(i.positive,e)):(t[h]=+i.negative,i.negative=St(i.negative,e)),t[c]=St(t[h],e),i.end=St(i.end,e)}i.isTotal=e,(u(p)||p===Ej)&&(t[Ej]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function GK(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?Px("total.collectCountField error"):n=e[a].start;o<0?Px("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=St(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 WK=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>St(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},UK={type:"fadeIn"},YK={type:"growCenterIn"};function KK(t,e){switch(e){case"fadeIn":return UK;case"scaleIn":return YK;default:return FY(t,!1)}}class XK extends eG{constructor(){super(...arguments),this.type=XK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}XK.type="rule";const $K=()=>{MN.registerMark(XK.type,XK),BD()},qK=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:ZK(t.map((t=>t.latestData)).flat(),e.fields,i)}};function ZK(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)=>ZK(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class JK{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 Mr(e instanceof Ar?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),JN(e,"dimensionTree",qK),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 QK extends YY{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const tX={rect:rX,symbol:sX,arc:oX,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=sX(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:lX,line:hX,area:hX,rect3d:rX,arc3d:oX,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function eX(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}const{formatFunc:h,args:c}=VG(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function iX(t){return d(t)?e=>t(e.data):t}function sX(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=iX(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:nX(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function nX(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function rX(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=iX(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;y(h)&&"outside"===h&&(p=t=>{const{data:e}=t,i=o.getMeasureField()[0],s=(null==e?void 0:e[i])>=0&&d||(null==e?void 0:e[i])<0&&!d?1:0;return{vertical:["top","bottom"],horizontal:["right","left"]}[c][s]}),u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:aX(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function aX(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 oX(t){var e;const{labelSpec:i}=t,s=null!==(e=iX(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 lX(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=eX(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),qg(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 hX(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}class cX extends KY{constructor(){super(...arguments),this.type=uL.waterfall,this.transformerConstructor=QK,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new JK(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=Ej)}getSeriesKeys(){return this._seriesField===Ej?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),JN(this._dataSet,"waterfallFillTotal",WK),JN(this._dataSet,"waterfall",NK),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=oV(this.getViewData(),this._dataSet,{name:`${gL}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new vU(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:Hj,endAs:Nj,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=DU(this);this._barMark.setAnimationConfig(wU(null===(i=MN.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),TU("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(wU(null===(s=MN.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),TU("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(cX.mark.leaderLine,{key:"index",customShape:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.stateSort});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=t);this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:At(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:At(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return lX(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?rH(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):rH(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}}cX.type=uL.waterfall,cX.mark=Cz,cX.transformerConstructor=QK;const dX=()=>{$K(),GY(),MN.registerAnimation("waterfall",((t,e)=>({appear:KK(t,e),enter:FY(t,!1),exit:jY(t,!1),disappear:jY(t,!1)}))),dG(),gY(),dY(),MN.registerSeries(cX.type,cX)},uX=`${gL}_BOX_PLOT_OUTLIER_VALUE`;var pX;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(pX||(pX={}));const gX=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[uX]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class fX extends SW{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===pX.OUTLIER)return this.series.getOutliersField();if(t===pX.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case pX.MIN:return this.series.getMinField();case pX.MAX:return this.series.getMaxField();case pX.MEDIAN:return this.series.getMedianField();case pX.Q1:return this.series.getQ1Field();case pX.Q3:return this.series.getQ3Field();case pX.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===pX.OUTLIER)return e[uX];if(t===pX.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case pX.MIN:return e[this.series.getMinField()];case pX.MAX:return e[this.series.getMaxField()];case pX.MEDIAN:return e[this.series.getMedianField()];case pX.Q1:return e[this.series.getQ1Field()];case pX.Q3:return e[this.series.getQ3Field()];case pX.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[uX])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(pX.OUTLIER),value:this.getContentValue(pX.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(pX.MAX),value:this.getContentValue(pX.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(pX.Q3),value:this.getContentValue(pX.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(pX.MEDIAN),value:this.getContentValue(pX.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(pX.Q1),value:this.getContentValue(pX.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(pX.MIN),value:this.getContentValue(pX.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(pX.SERIES_FIELD),value:this.getContentValue(pX.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class mX extends eG{constructor(){super(...arguments),this.type=mX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}mX.type="boxPlot";const vX=()=>{MN.registerMark(mX.type,mX),EO.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(jD).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&eS(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&eS(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&eS(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&eS(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&eS(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&eS(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&eS(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&eS(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),EO.registerAnimationType("boxplotScaleIn",zD),EO.registerAnimationType("boxplotScaleOut",HD),OD(),PD(),BD(),EO.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(VD).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&eS(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&eS(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&eS(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&eS(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&eS(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),EO.registerAnimationType("barBoxplotScaleIn",GD),EO.registerAnimationType("barBoxplotScaleOut",WD),OD(),PD(),BD()};class yX extends FU{constructor(){super(...arguments),this.type=uL.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(yX.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(yX.mark.outlier,{progressive:t,key:Oj,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"},n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},s),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(a,n,gV.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},gV.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=>rH(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>rH(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>rH(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>rH(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>rH(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},gV.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>rH(e(this.getDatumPositionValues(t,uX),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>rH(e(this.getDatumPositionValues(t,uX),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,gV.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;JN(this._dataSet,"foldOutlierData",gX),JN(this._dataSet,"addVChartProperty",uU);const t=new Mr(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${gL}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:xU.bind(this),call:SU}},!1),this._outlierDataView=new vU(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=I({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=DU(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=MN.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(TU("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(wU(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(wU(null===(a=MN.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new fX(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}yX.type=uL.boxPlot,yX.mark=Ez;class _X extends eG{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=_X.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}_X.type="text";const bX=()=>{MN.registerMark(_X.type,_X),LD(),Jw(),qw(),EO.registerGraphic(FL.richtext,xm)};function xX(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}class SX extends SW{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}const AX=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),kX={type:"fadeIn"},MX=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function wX(t,e){return"fadeIn"===e?kX:AX(t)}class TX extends YY{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 CX extends KY{constructor(){super(...arguments),this.type=uL.rangeColumn,this._barMarkType="rect",this._barName=uL.bar,this.transformerConstructor=TX}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(CX.mark.bar,{morph:PU(this._spec,CX.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.bar)||void 0===i?void 0:i.stateSort}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(CX.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(CX.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});xX(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});xX(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=DU(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(wU(null===(i=MN.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),TU("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(wU(null===(s=MN.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),TU("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(wU(null===(n=MN.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),TU("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new SX(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)}}CX.type=uL.rangeColumn,CX.mark=Iz,CX.transformerConstructor=TX;const EX=()=>{GY(),bX(),MN.registerAnimation("rangeColumn",((t,e)=>({appear:wX(t,e),enter:AX(t),exit:MX(t),disappear:MX(t)}))),dG(),gY(),dY(),MN.registerSeries(CX.type,CX)};class PX extends CX{constructor(){super(...arguments),this.type=uL.rangeColumn3d,this._barMarkType="rect3d",this._barName=uL.bar3d}}PX.type=uL.rangeColumn3d,PX.mark=Dz;class BX extends SW{getDefaultTooltipPattern(t,e){switch(t){case"mark":case"group":return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}class RX extends LY{constructor(){super(...arguments),this.type=uL.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(RX.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:e,stateSort:i})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new BX(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}RX.type=uL.rangeArea,RX.mark=Hz;class LX extends OU{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=OL,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)?V(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?V(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=V(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(V(t)),s=this.radiusAxisHelper.dataToPosition(V(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:s})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};mR(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:[]};mR(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)&&IU(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}const OX=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:s,startAngle:n,endAngle:r,minAngle:a,asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=e,g=(t,e,i)=>{t[o]=e,t[l]=e+i,t[h]=e+i/2,t[c]=i,t[u]=function(t){return(t=Pt(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}(e+i/2)};let f=0,m=-1/0;for(let t=0;tNumber(t[s]))),_=r-n;let b=n,x=_,S=0;const A=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const 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))}(y);if(i.forEach(((t,e)=>{const i=t[AL],s=f?i/f:0;let n=s*_;n{g(e,n+i*t,t)}))}else{const t=x/S;b=n,i.forEach((e=>{const i=e[c]===a?a:e[AL]*t;g(e,b,i),b+=i}))}return 0!==f&&(i[i.length-1][l]=r),i};function IX(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const DX=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:IX(t,!0,uV.appear)}),FX={type:"fadeIn"},jX=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:IX(t,!0,uV.enter)}),zX=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:IX(t,!0,uV.exit)}),HX=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:IX(t,!0,uV.exit)});function NX(t,e){if(!1===e)return{};switch(e){case"fadeIn":return FX;case"growRadius":return DX(Object.assign(Object.assign({},t),{growField:"radius"}));default:return DX(Object.assign(Object.assign({},t),{growField:"angle"}))}}class VX extends eG{constructor(t,e){super(t,e),this.type=GX.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Et({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[CL])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class GX extends VX{constructor(){super(...arguments),this.type=GX.type}}GX.type="arc";const WX=()=>{Jw(),Pw(),EO.registerGraphic(FL.arc,Pm),CD.useRegisters([fj,mj,pj,gj]),MN.registerMark(GX.type,GX)};class UX extends LU{_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=VH({},this._theme,i,t);const n=(t,e)=>VH({},"inside"===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}}class YX extends LX{constructor(){super(...arguments),this.transformerConstructor=UX,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=BL,this._endAngle=RL,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[CL];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Et(this.computeCenter(t),(i+s)/2,e)}}getCenter(){var t,e,i,s;const{width:n,height:r}=this._region.getLayoutRect();return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:n/2,y:null!==(s=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==s?s:r/2}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const i=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?Tt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Tt(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=p(this._spec.padAngle)?Tt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;JN(this._dataSet,"pie",OX),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,minAngle:p(this._spec.minAngle)?Tt(this._spec.minAngle):0,asStartAngle:ML,asEndAngle:wL,asRatio:kL,asMiddleAngle:CL,asRadian:PL,asQuadrant:EL,asK:TL}},!1);const e=new Mr(this._dataSet,{name:`${gL}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new vU(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},YX.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:PU(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:Ij,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:null===(t=this._spec.pie)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.pie)||void 0===e?void 0:e.stateSort})}startAngleScale(t){return pR(ML)(t)}endAngleScale(t){return pR(wL)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:aH(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:aH(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",t.AttributeLevel.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i,s){if(super.initMarkStyleWithSpec(e,i,s),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:pR(bL).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){(i=null!=i?i:{data:!0}).centerX=!0,i.centerX=!0,i.centerY=!0,i.centerOffset=!0,i.radius=!0,i.innerRadius=!0,i.cornerRadius=!0,i.startAngle=!0,i.endAngle=!0,i.padAngle=!0;const{centerX:s,centerY:n,centerOffset:r,radius:a,innerRadius:o,cornerRadius:l,startAngle:h,endAngle:c,padAngle:d}=e,u=super._compareSpec(t,e,i);return(t=null!=t?t:{}).centerY===n&&t.centerX===s&&t.centerOffset===r&&t.radius===a&&t.innerRadius===o&&t.cornerRadius===l&&t.startAngle===h&&t.endAngle===c&&t.padAngle===d||(u.reRender=!0,u.change=!0),u}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[CL];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Et(this.computeCenter(t),s,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var s;if(i===uV.appear)return this._startAngle;if(i===uV.disappear)return this._endAngle;const n=[uV.disappear,uV.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[Oj];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[Oj]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[Oj])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[Oj])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Et({x:0,y:0},a,e[CL]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Et({x:0,y:0},a,e[CL]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Et({x:0,y:0},a,e[CL]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Et({x:0,y:0},a,e[CL]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}YX.transformerConstructor=UX,YX.mark=mz;class KX extends YX{constructor(){super(...arguments),this.type=uL.pie}}KX.type=uL.pie;const XX=()=>{WX(),MN.registerAnimation("pie",((t,e)=>({appear:NX(t,e),enter:jX(t),exit:zX(t),disappear:HX(t)}))),MN.registerSeries(KX.type,KX)};class $X extends VX{constructor(){super(...arguments),this.type=$X.type,this._support3d=!0}}$X.type="arc3d";class qX extends UX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class ZX extends YX{constructor(){super(...arguments),this.type=uL.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=qX}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const e=this._pieMark;e&&this.setMarkStyle(e,{beta:()=>this._angle3d},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e,i={}){if(!e)return;super.initLabelMarkStyle(e);const s={};e.setSupport3d(!0),s.beta=this._angle3d,s.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},s.angle=t=>{const e=t[CL];return"inside"===i.position?Ct(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}ZX.type=uL.pie3d,ZX.mark=vz,ZX.transformerConstructor=qX;const JX=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},QX={type:"fadeIn"},t$=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),e$=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),i$=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function s$(t,e){if(!1===e)return{};switch(e){case"fadeIn":return QX;case"growAngle":return JX(Object.assign(Object.assign({},t),{growField:"angle"}));default:return JX(Object.assign(Object.assign({},t),{growField:"radius"}))}}class n$ extends LX{getStackGroupFields(){return this._angleField}getStackValueField(){return V(this._spec.valueField)[0]||V(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(Nj),this.setInnerRadiusField(Hj)}setValueFieldToPercent(){this.setRadiusField(Gj),this.setInnerRadiusField(Vj)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class r$ extends LU{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const a$=(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:LL,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.radius)&&void 0!==a?a:e.outerRadius)&&void 0!==o?o:e.radius)&&void 0!==l?l:OL,layoutRadius:e.layoutRadius}};class o$ extends iY{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!_(e)){if(!KG(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=a$(e,t);return e.center=a,e.startAngle=n,e.endAngle=r,e.outerRadius=o,e.type=i,e.layoutRadius=l,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const i=[];let s;const n=[];return e.forEach(((e,r)=>{if(!KG(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=a$(e,t);e.center=c,e.startAngle=l,e.endAngle=h,e.outerRadius=d,e.type=a,e.layoutRadius=u;const p={spec:e,specPath:[this.specKey,r],specInfoPath:["component",this.specKey,r],type:o};i.push(p),"radius"===e.orient?n.push(p):s=r})),n.forEach((t=>{t.angleAxisIndex=s})),i}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=MN.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=BL,this._endAngle=RL,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),cR(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Tt(this._spec.startAngle),this._endAngle=Tt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:WG(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}afterCompile(){var e;const i=null===(e=this._axisMark)||void 0===e?void 0:e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){cR(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return mR(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:mR(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 Et(this.getCenter(),t.radius,t.angle)}pointToCoord(t){const{x:e,y:i}=this.getCenter();let s=t.x-e,n=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(s*s+n*n);s/=o,n/=o;let l=Math.atan2(n,s);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:hH(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:hH(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>ZG(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),s=this._endAngle-this._startAngle,n=this.getLabelItems(s),r=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle}),a=Object.assign(Object.assign({},r),{title:{text:this._spec.title.text||this._dataFieldText},items:n,orient:"angle"});this._spec.grid.visible&&(a.grid=Object.assign({type:"line",smoothLink:!0,items:n[0]},r)),this._update(a)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=Mt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAngleAxis())||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAngleAxis(){const t=this._option.angleAxisIndex;if(p(t))return this._option.getComponentByIndex(this.specKey,t)}computeLayoutRadius(){const t=this.getRefLayoutRect();if(S(this._spec.layoutRadius))return this._spec.layoutRadius;if(d(this._spec.layoutRadius))return this._spec.layoutRadius(t,this.getCenter());const{width:e,height:i}=t;return"auto"===this._spec.layoutRadius&&e>0&&i>0?Bt(t,this.getCenter(),this._startAngle,this._endAngle):Math.min(e/2,i/2)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this.computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this.computeLayoutRadius()*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=OL,e=0;const i=this.getChart().getSpec();return cR(this.getRegions(),(s=>{const n=s;if(r=n.type,[uL.rose,uL.radar,uL.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(VH({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(VH({},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)}}o$.type=r.polarAxis,o$.specKey="axes";class l$ extends o${constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new aL}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}}l$.type=r.polarLinearAxis,l$.specKey="axes",N(l$,hY);const h$=()=>{sY(),MN.registerComponent(l$.type,l$)};class c$ extends o${constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new zR}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}c$.type=r.polarBandAxis,c$.specKey="axes",N(c$,uY);const d$=()=>{sY(),MN.registerComponent(c$.type,c$)};class u$ extends n${constructor(){super(...arguments),this.type=uL.rose,this.transformerConstructor=r$,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(u$.mark.rose,{morph:PU(this._spec,u$.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(t=this._spec.rose)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.rose)||void 0===e?void 0:e.stateSort})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>rH(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=rH(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(wU(null===(i=MN.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),TU("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}u$.type=uL.rose,u$.mark=yz,u$.transformerConstructor=r$;const p$=()=>{MN.registerSeries(u$.type,u$),WX(),MN.registerAnimation("rose",((t,e)=>({appear:s$(t,e),enter:t$(t),exit:e$(t),disappear:i$(t)}))),d$(),h$()};class g$ extends qd{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;d(r)&&d(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:s}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=s}}}class f$ extends xu{constructor(t,e,i,s,n){super(t,e,i,s,n);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const s=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}polarPointInterpolation(t,e,i){const s=this._pointToCoord(t),n=this._pointToCoord({x:t.x1,y:t.y1}),r=Pt(s.angle),a=Pt(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=Pt(o.angle),c=Pt(l.angle),d=r+(h-r)*i,u=s.radius+(o.radius-s.radius)*i,p=a+(c-a)*i,g=n.radius+(l.radius-n.radius)*i,{x:f,y:m}=this._coordToPoint({angle:d,radius:u}),{x:v,y:y}=this._coordToPoint({angle:p,radius:g}),_=new kt(f,m,v,y);return _.defined=e.defined,_}}const m$=t=>({type:"in"===t?"fadeIn":"fadeOut"});function v$(t,e,i){return"fadeIn"===e?m$(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function y$(t,e,i){return"fadeIn"===e?m$(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 _$=(t,e)=>({custom:Au,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class b$ extends n${constructor(){super(...arguments),this.type=uL.radar,this.transformerConstructor=KU,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(b$.mark.area,{progressive:t,isSeriesMark:e,customShape:null===(i=this._spec.area)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.area)||void 0===s?void 0:s.stateSort})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:zU,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{dimension:t,group:e,mark:i}=this._tooltipHelper.activeTriggerSet;this._lineMark&&(t.add(this._lineMark),e.add(this._lineMark)),this._areaMark&&(t.add(this._areaMark),e.add(this._areaMark)),this._symbolMark&&(i.add(this._symbolMark),e.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?Tt(this._spec.startAngle):BL,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(wU(null===(s=MN.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),TU("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=MN.getAnimationInKey(e);t.setAnimationConfig(wU(null==i?void 0:i(n,r),TU(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}}}b$.type=uL.radar,b$.mark=fz,b$.transformerConstructor=KU,N(b$,HU);const x$=()=>{MN.registerSeries(b$.type,b$),_F(),EY(),GU(),YU(),MN.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:v$(t,e,"in"),enter:v$(t,e,"in"),exit:v$(t,e,"out"),disappear:"clipIn"===e?void 0:v$(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:f$,customParameters:t,duration:oG.update.duration,easing:oG.update.easing}]}))),MN.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:y$(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:y$(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:g$,customParameters:t,duration:oG.update.duration,easing:oG.update.easing}]}))),MN.registerAnimation("radarGroup",((t,e)=>({appear:_$(t,"in"),disappear:_$(t,"out")}))),Pw(),d$(),h$()};class S$ extends SW{updateTooltipSpec(){var t;super.updateTooltipSpec(),p(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"event_time",value:t=>be.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const s=[];return t[3].value.forEach((t=>{let i=!0;for(const n in t)s.push({shapeType:"circle",hasShape:i,shapeColor:this.shapeColorCallback(e[0].datum[0]),shapeStroke:this.shapeStrokeCallback(e[0].datum[0]),key:n,value:t[n]+""}),i=!1})),t.concat(s)}}:null}}const A$=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},k$={fill:"#bbb",fillOpacity:.2};class M$ extends FU{constructor(){super(...arguments),this.type=uL.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),JN(this._option.dataSet,"objFlat",A$),JN(this._option.dataSet,"copyDataView",aV),QN(this._option.dataSet,"dataview",br),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:cV.dotObjFlat},!1)}setSeriesField(t){p(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(VH(k$,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(M$.mark.group),this._containerMark=this._createMark(M$.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(M$.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(M$.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(M$.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(M$.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(M$.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(M$.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setInteractive(!1));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(e){var i,s;super.onLayoutEnd(e);const n=null!==(s=null===(i=this._spec)||void 0===i?void 0:i.leftAppendPadding)&&void 0!==s?s:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:Dj}}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 iH).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:Dj}}initTooltip(){this._tooltipHelper=new S$(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}M$.type=uL.dot,M$.mark=Az;class w$ extends SW{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"time",value:t=>be.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,key:"to",value:t=>t.to}]}:null}}const T$=(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 C$ extends FU{constructor(){super(...arguments),this.type=uL.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),JN(this._option.dataSet,"linkDotInfo",T$),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:cV.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(C$.mark.group),this._containerMark=this._createMark(C$.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(C$.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(C$.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",t.AttributeLevel.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setInteractive(!1));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:Dj}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new w$(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}C$.type=uL.link,C$.mark=Sz;class E$ extends LX{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()?Hj:$j],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Tt(i.offsetAngle);let o;if(p(s)){const t=Q(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()?Nj:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Tt(i.offsetAngle),o=Q(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)?Tt(n):BL;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?Tt(r):RL,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=rH(this.angleAxisHelper.dataToPosition([t[Hj]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=rH(this.angleAxisHelper.dataToPosition([t[Nj]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(E$.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),e.setClip((()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+Tt(s),n=Tt(i)/2;return Pm(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[lm({width:e,height:i,fill:!0})]})),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const R$=()=>{MN.registerAnimation("circularProgress",((t,e)=>({appear:B$(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class L$ extends LU{constructor(){super(...arguments),this._supportStack=!0}}class O$ extends E${constructor(){super(...arguments),this.type=uL.circularProgress,this.transformerConstructor=L$,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(k(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(k(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(O$.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(O$.mark.track,{parent:this._arcGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?Hj:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?Nj: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(wU(null===(i=MN.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),TU("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(wU(null===(s=MN.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),TU("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}O$.type=uL.circularProgress,O$.mark=xz,O$.transformerConstructor=L$;function I$(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const D$=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:I$(t)}),F$={type:"fadeIn"};function j$(t,e){return!1===e?{}:"fadeIn"===e?F$:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:I$(t)}))(t)}class z$ extends SW{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);switch(t){case"mark":case"group":return i;case"dimension":return i.visible=!1,i}return null}}class H$ extends FU{constructor(){super(...arguments),this.type=uL.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e;return this._progressMark=this._createMark(H$.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:null===(t=this._spec.progress)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.progress)||void 0===e?void 0:e.stateSort}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n,r,a,o,l;const h=this._progressMark;if(h)if("vertical"===this._spec.direction){const r=null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.leftPadding)&&void 0!==i?i:0,a=null!==(n=null===(s=this._spec.progress)||void 0===s?void 0:s.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return rH(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2+r},y:t=>{var e,i;return rH(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-r-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=null!==(a=null===(r=this._spec.progress)||void 0===r?void 0:r.topPadding)&&void 0!==a?a:0,i=null!==(l=null===(o=this._spec.progress)||void 0===o?void 0:o.bottomPadding)&&void 0!==l?l:0;this.setMarkStyle(h,{x:t=>{var e,i;return rH(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:t=>{var i,s;return rH(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0))-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-i,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(H$.mark.track,{parent:this._progressGroupMark,customShape:null===(t=this._spec.track)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.track)||void 0===e?void 0:e.stateSort}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return rH(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return rH(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(H$.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const e=this._progressGroupMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var s,n,r,a;if("vertical"===this._spec.direction){const i=rH(this.dataToPositionX(t),null===(n=null===(s=this._xAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(lm({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=rH(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,s=this._scaleX.range()[1];e.push(lm({x:0,y:i,height:this._spec.bandWidth,width:s,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",t.AttributeLevel.Series),this._progressGroupMark.setInteractive(!1)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(wU(null===(i=MN.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),TU("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(wU(null===(s=MN.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),TU("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new z$(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}H$.type=uL.linearProgress,H$.mark=Tz;const N$=()=>{GY(),MN.registerAnimation("linearProgress",((t,e)=>({appear:j$(t,e),enter:{type:"grow"},disappear:D$(t)}))),dG(),MN.registerSeries(H$.type,H$)},V$=[0],G$=[20,40],W$=[200,500],U$={shrink:!1,enlarge:!1,fontSizeLimitMin:0},Y$=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],K$=`${gL}_WORD_CLOUD_WEIGHT`,X$=`${gL}_WORD_CLOUD_TEXT`;class $$ extends OU{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._colorHexField?t=>t[this._colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t))}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=G$}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:W$,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:V$,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(n=this._spec.random)||void 0===n||n,this._fontPadding=null!==(a=null===(r=this._spec.word)||void 0===r?void 0:r.padding)&&void 0!==a?a:1,this._textField=(null===(o=this._spec.word)||void 0===o?void 0:o.formatMethod)?X$:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:U$},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:V$,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=null!==(h=null===(l=this._spec.fillingWord)||void 0===l?void 0:l.padding)&&void 0!==h?h:1,this._isWordCloudShape=!Y$.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){this._wordMark=this._createMark($$.mark.word,{key:Ij,defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var e,i,s;const n=this._wordMark,r=null!==(e=this._spec.word)&&void 0!==e?e:{};n&&(this.setMarkStyle(n,{fill:this.getWordColor,text:t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(n,{fontFamily:null!==(s=null===(i=r.style)||void 0===i?void 0:i.fontFamily)&&void 0!==s?s:this._defaultFontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){var t,e;const i=this._wordMark;if(i){const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n={animationConfig:()=>{var t,e;return null===(e=null===(t=i.getAnimationConfig())||void 0===t?void 0:t.appear)||void 0===e?void 0:e[0]}};i.setAnimationConfig(wU(MN.getAnimationInKey("wordCloud")(n,s),TU("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 iH).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return t=>{var e;return i.scale(t[null!==(e=this._seriesField)&&void 0!==e?e:Dj])}}let s=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e;super.compile();const{width:i,height:s}=this._region.getLayoutRect();if(!k(i)||!k(s)||!(s>0&&i>0))return;const n=[],r=this._valueField,a=new aL,o=this._fontWeightRange;if(r){const[e,i]=$x(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[r])));a.domain([e,i],!0).range(o),n.push({type:"map",as:K$,callback:t=>e===i?a.scale(i):a.scale(t[r])})}const l=null!==(e=this._spec.word)&&void 0!==e?e:{};l.formatMethod&&n.push({type:"map",as:X$,callback:l.formatMethod}),this._isWordCloudShape?n.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):n.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(n)}_wordCloudTransformOption(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{};return{layoutType:Ix(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:Ij,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotate:this._rotateAngles,fontFamily:null!==(s=null!==(i=this._fontFamilyField)&&void 0!==i?i:o.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:K$}:null,fontStyle:null!==(n=this._fontStyleField)&&void 0!==n?n:o.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,s,n,r,a,o,l,h;const{width:c,height:d}=this._region.getLayoutRect(),u=null!==(e=null===(t=this._spec.word)||void 0===t?void 0:t.style)&&void 0!==e?e:{},p=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{},g=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:Ij,size:[c,d],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:null!==(n=null!==(s=this._fontFamilyField)&&void 0!==s?s:u.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:K$}:null,fontStyle:null!==(r=this._fontStyleField)&&void 0!==r?r:u.fontStyle,fillingFontFamily:null!==(o=null!==(a=p.fillingFontFamilyField)&&void 0!==a?a:u.fontFamily)&&void 0!==o?o:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(l=p.fillingFontStyleField)&&void 0!==l?l:u.fontStyle,fillingFontWeight:null!==(h=p.fillingFontWeightField)&&void 0!==h?h:u.fontWeight,fillingRotateList:g,fillingTimes:p.fillingTimes,fillingXStep:p.fillingXStep,fillingYStep:p.fillingYStep,fillingXRatioStep:p.fillingXRatioStep,fillingYRatioStep:p.fillingYRatioStep,fillingInitialOpacity:p.fillingInitialOpacity,fillingDeltaOpacity:p.fillingDeltaOpacity,fillingInitialFontSize:p.fillingInitialFontSize,fillingDeltaFontSize:p.fillingDeltaFontSize,ratio:p.ratio,fillingRatio:p.fillingRatio,removeWhiteBorder:p.removeWhiteBorder,textLayoutTimes:p.textLayoutTimes,fontSizeShrinkFactor:p.fontSizeShrinkFactor,stepFactor:p.stepFactor,layoutMode:p.layoutMode,importantWordCount:p.importantWordCount,globalShinkLimit:p.globalShinkLimit,fontSizeEnlargeFactor:p.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:p.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}$$.mark=kz;function q$(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||oG.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1-Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function J$(){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 Q$(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.6),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"rect":n=Math.floor(Math.max(s/2,i/2));break;default:n=Math.floor(Math.min(i/2,s/2))}return{maxRadius:n,center:r}}const tq=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function eq(t){return fa(t)?t:function(){return t}}class iq{constructor(t){var e,i,s;switch(this.options=Va({},iq.defaultOptions,t),fa(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,Z$[s]?Z$[s]():Z$.circle()),this.getText=null!==(e=eq(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=eq(this.options.fontWeight),this.getTextFontSize=eq(this.options.fontSize),this.getTextFontStyle=eq(this.options.fontStyle),this.getTextFontFamily=eq(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>tq(10,50);break;case"random-light":this.getTextColor=()=>tq(50,90);break;default:this.getTextColor=eq(this.options.color)}if(ma(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=fa(this.options.rotate)?t=>{var e;return qo(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=$a(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return qo(i[Math.floor(s*i.length)])}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!ma(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 nq extends iq{constructor(t){var e;super(Va({},nq.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<=nq.defaultOptions.minFontSize&&(this.options.minFontSize=nq.defaultOptions.minFontSize),this.spiral=Sa(this.options.spiral)?null!==(e=sq[this.options.spiral])&&void 0!==e?e:sq.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=eq(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}=Q$(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,y=[];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;y[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=y.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(db.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const s=t.length;let n=0;this.result=[];const r=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));this.data=r;let a=0;for(;n=2?(n++,a=0):a++,this.progressiveIndex=n,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d");return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let 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(lq(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(oq(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}lq(p,this._size)&&(p=hq(p,this._size))}else if(lq(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||aq(p,i))&&(!i||!rq(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 rq(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 aq(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,lq=(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 hq(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),y=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=y*this.gridSize;const _=-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,_,b);const M=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const w=[];let T,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:E,gw:S,gh:x,fillTextOffsetX:_,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}canFitText(t,e,i,s,n){let r=n.length;for(;r--;){const i=t+n[r][0],s=e+n[r][1];if(i>=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),to(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let s=i.getImageData(0,0,1,1).data,n=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(n[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==s[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}n=i=s=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=Q$(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e.canvas),this.result=[];let n=0;for(;n0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}dq.defaultOptions={enlarge:!1};const pq={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},gq=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return lo.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?fq(t.fontFamily):"sans-serif",d=t.fontStyle?fq(t.fontStyle):"normal",u=t.fontWeight?fq(t.fontWeight):"normal",p=t.rotate?fq(t.rotate):0,g=fq(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?fq(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",y=null!==(r=t.shrink)&&void 0!==r&&r,_=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,S=t.randomVisible,A=t.as||pq,k=t.depth_3d,M=t.postProjection;let w=t.fontSize?fq(t.fontSize):14;const T=t.fontSizeRange;if(T&&!wa(w)){const t=w,e=vq(yq(t,l),T);w=i=>e(t(i))}let C=nq;"fast"===t.layoutType?C=dq:"grid"===t.layoutType&&(C=cq);const E=new C({text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:y,clip:b,enlarge:_,minFontSize:x,random:S,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,s;for(let n=0,r=t.length;n0||t.progressiveTime>0?{progressive:E}:E.output()},fq=t=>Sa(t)||wa(t)||fa(t)||Aa(t)?t:e=>e[t.field],mq=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),vq=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=mq(t[0]),s=mq(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(mq(t)-n)/(r-n)*(e[1]-e[0])+e[0]},yq=(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 _q(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{EO.registerTransform("wordcloud",{transform:gq,markPhase:"beforeJoin"},!0),bX(),MN.registerAnimation("wordCloud",((t,e)=>({appear:q$(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),MN.registerSeries(bq.type,bq)};(class extends $${constructor(){super(...arguments),this.type=uL.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark($$.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle();const e=this._wordMark;e&&this.setMarkStyle(e,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(wU(null===(e=MN.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),TU("word",this._spec,this._markAttributeContext)))}}).type=uL.wordCloud3d;const Sq=(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,y=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),_=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:_,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:y];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),_=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=k(_*v)&&0!==v?_/v:0,S=k(v*y)&&0!==y?v/y:0;u&&(t[u]=y),g&&(t[g]=_),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]:_/b[1]),d&&(t[d]=0===e?1:y/b[1]),p&&(t[p]=v)})),n},Aq=(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},kq=`${gL}_FUNNEL_TRANSFORM_RATIO`,Mq=`${gL}_FUNNEL_REACH_RATIO`,wq=`${gL}_FUNNEL_HEIGHT_RATIO`,Tq=`${gL}_FUNNEL_VALUE_RATIO`,Cq=`${gL}_FUNNEL_LAST_VALUE_RATIO`,Eq=`${gL}_FUNNEL_NEXT_VALUE_RATIO`,Pq=`${gL}_FUNNEL_LAST_VALUE`,Bq=`${gL}_FUNNEL_CURRENT_VALUE`,Rq=`${gL}_FUNNEL_NEXT_VALUE`,Lq=`${gL}_FUNNEL_TRANSFORM_LEVEL`,Oq=20;class Iq extends SW{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[Mq])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class Dq extends eG{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class Fq extends Dq{constructor(){super(...arguments),this.type=Fq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}Fq.type="polygon";const jq=()=>{MN.registerMark(Fq.type,Fq),Jw(),Yw(),EO.registerGraphic(FL.polygon,Lm),CD.useRegisters([oj,lj])};class zq extends LU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class Hq extends OU{constructor(){super(...arguments),this.type=uL.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=zq,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;JN(this._dataSet,"funnel",Sq),JN(this._dataSet,"funnelTransform",Aq);const t=new Mr(this._dataSet,{name:`${gL}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new vU(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:Bq,asTransformRatio:kq,asReachRatio:Mq,asHeightRatio:wq,asValueRatio:Tq,asNextValueRatio:Eq,asLastValueRatio:Cq,asLastValue:Pq,asNextValue:Rq,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:Lq}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},Hq.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:PU(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:null===(e=this._spec.funnel)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.funnel)||void 0===i?void 0:i.stateSort,noSeparateStyle:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},Hq.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:null===(n=this._spec.transform)||void 0===n?void 0:n.customShape,stateSort:null===(r=this._spec.transform)||void 0===r?void 0:r.stateSort,noSeparateStyle:!0})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(Hq.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(Hq.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new Iq(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const e=this._funnelMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const i=this._funnelTransformMark;i&&this.setMarkStyle(i,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{text:t=>{const e=`${t[this.getCategoryField()]}`;return d(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(e,t):e},x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t)},"normal",t.AttributeLevel.Series);const n=this._funnelOuterLabelMark.line;n&&s&&this.setMarkStyle(n,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;if(!e)return;const n=e.getTarget(),r=e.getComponent();n===this._funnelMark?(this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(r),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*pR(Mq).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(wU(null===(s=MN.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),TU("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(wU(MN.getAnimationInKey("fadeInOut")(),TU(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(wU(MN.getAnimationInKey("funnel")({},o),TU(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(wU(null===(a=MN.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),TU("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[Cq])/2:this._getSecondaryAxisLength(t[Tq])/2,n=this._getSecondaryAxisLength(t[Tq])/2):(s=this._getSecondaryAxisLength(t[Tq])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[Eq])/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[Lq])}_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[Ij]===t[Ij]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const a=this.getPoints(t),o=(Math.abs(a[0].x-a[1].x)+Math.abs(a[2].x-a[3].x))/2,l=this.getCategoryField(),h=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[l])===t[l]}),!0))||void 0===s?void 0:s.AABBBounds,c=h?h.x2-h.x1:0,d=this._funnelOuterLabelMark.line?Oq:0;let u=this.getLayoutRect().width-Math.max(o,c);return"center"===this._funnelAlign&&(u/=2),u-d-(null!==(r=null===(n=this._spec.outerLabel)||void 0===n?void 0:n.spaceWidth)&&void 0!==r?r:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d;const u=this.getCategoryField(),p=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[u])===t[u]})))||void 0===r?void 0:r.getBounds(),g=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct().getGroupGraphicItem().find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[u])===t[u]}),!0))||void 0===l?void 0:l.AABBBounds,f=null!==(h=this._spec.outerLabel)&&void 0!==h?h:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(c=f.spaceWidth)&&void 0!==c?c:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==p?void 0:p.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{jq(),bX(),$K(),MN.registerSeries(Hq.type,Hq),MN.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},hG))),MN.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:ku,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:ku,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),dG()};class Vq extends Dq{constructor(){super(...arguments),this.type=Vq.type}}Vq.type="pyramid3d";class Gq extends zq{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class Wq extends Hq{constructor(){super(...arguments),this.type=uL.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=Gq}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},Wq.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},Wq.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(Wq.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(Wq.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const e=this._funnelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series)}initLabelMarkStyle(e){var i,s;super.initLabelMarkStyle(e),this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",t.AttributeLevel.Series),this._labelMark=e,(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.label)&&this._funnelOuterLabelMark.label.setDepend(e.getComponent()),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}Wq.type=uL.funnel3d,Wq.mark=wz,Wq.transformerConstructor=Gq;const Uq=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},Yq=t=>{const e=t.mark.elements.filter((t=>t.diffState===DL.update)),i=U(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},Kq=(t,e,i)=>{if(E(t))return[e,i];const s=U(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=W(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},Xq=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=Yq(i),a=Kq(r,s,n);return Uq(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=Yq(i),a=Kq(r,s,n);return Uq(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),$q=t=>{const e=U(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=W(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},qq=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=Yq(i),a=$q(r);return Uq(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=Yq(i),a=$q(r);return Uq(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),Zq=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},Jq=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):Jq(t.children,e,i)))})),e};function Qq(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,y=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),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=s?s:-1,l=i;return t.forEach(((t,s)=>{var h,c;const d={flattenIndex:++o,key:r?r(t):`${null!==(h=null==n?void 0:n.key)&&void 0!==h?h:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t.value,isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(c=t.children)||void 0===c?void 0:c.length){d.children=[],d.isLeaf=!1;const e=iZ(t.children,d.children,i+1,o,d,r);d.value=ma(t.value)?e.sum:Math.max(e.sum,wo(t.value)),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else d.isLeaf=!0,d.value=wo(t.value);a+=Math.abs(d.value),e.push(d)})),{sum:a,maxDepth:l,flattenIndex:o}},sZ=(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=sZ(t.children,e,t,n))})),s},nZ=(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=nZ(t.children,e,t,n)),n=e(t,s,i,n)})),n},rZ={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*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:Qq,slice:tZ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?tZ:Qq)(t,e,i,s,n)}};class aZ{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=Aa(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=Aa(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=Aa(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=Aa(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({},aZ.defaultOpionts,t);const i=this.options.nodeKey,s=fa(i)?i:i?Yx(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?eZ(this.options.aspectRatio):null!==(e=rZ[this.options.splitType])&&void 0!==e?e:rZ.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=iZ(t,n,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(wa(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(wa(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)}))}}aZ.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const oZ=(t,e)=>{const i=new aZ(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return Jq(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},lZ={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class hZ{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];Qq(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),lZ);const s=Aa(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,ga(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},hZ.defaultOpionts,t):Object.assign({},hZ.defaultOpionts);const e=this.options.nodeKey,i=fa(e)?e:e?Yx(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Zx(this.options.center[0],t.width),s=t.y0+Zx(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=Aa(r),l=o?r.map((t=>Zx(t,n))):Zx(r,n),h=Aa(a),c=this.options.gapRadius,d=h?a.map((t=>Zx(t,n))):Zx(a,n),u=io(0,e+1);if(o)this._parsedInnerRadius=u.map(((t,e)=>{const i=l[e];return ma(i)?n:i})),this._parsedOutterRadius=u.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:ima(d[e])?n:d[e])),this._parsedInnerRadius=u.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(Aa(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Zx(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=u.map(((e,s)=>t+s*i)),this._parsedOutterRadius=u.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(Aa(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=iZ(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=Qo({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)}}}hZ.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const cZ=4294967296;function dZ(t,e){let i,s;if(gZ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function gZ(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function yZ(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 _Z(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 bZ(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 xZ(t){return{_:t,next:null,prev:null}}function SZ(t,e){const i=(t=$a(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];yZ(n,s,r);let a,o,l,h,c,d,u,p=xZ(s),g=xZ(n),f=xZ(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:Aa(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=iZ(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%cZ)/cZ}(),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:d}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=fa(l)?this.options.nodeKey:wZ.defaultOpionts.nodeSort;sZ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)sZ([o],AZ(h)),nZ([o],kZ(this._getPadding,.5,a)),sZ([o],MZ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);sZ([o],AZ(wZ.defaultOpionts.setRadius)),nZ([o],kZ(Xx,1,a)),c&&nZ([o],kZ(this._getPadding,o.radius/t,a)),sZ([o],MZ(t/(2*o.radius),this._maxDepth))}return d?[o]:n}}wZ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const TZ=(t,e={})=>{if(!t)return[];const i=[];return Jq(t,i,e),i},CZ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new hZ(i).layout(t,{width:s,height:n})};class EZ extends SW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var PZ;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(PZ||(PZ={}));const BZ=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===PZ.DrillDown){return V(_N(t,n,s,"children"))}if(i.type===PZ.DrillUp){const e=bN(t,n,s,"children");if(e)return V(e)}return t};class RZ{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=RK(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;JN(t,"drillFilter",BZ),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(!_(e)||E(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:PZ.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:PZ.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(!_(r)||E(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:PZ.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:PZ.DrillUp},model:this}),r}}class LZ extends LX{constructor(){super(...arguments),this.type=uL.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:_U),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:Ij},getRawData:()=>this.getRawData()}),this._startAngle=Tt(this._spec.startAngle),this._endAngle=Tt(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),JN(this._dataSet,"sunburstLayout",CZ),JN(this._dataSet,"flatten",TZ),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[p(this._centerX)?this._centerX:this.getLayoutRect().width/2,p(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:yU,operations:["max","min","values"]},{key:_U,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(JN(t.dataSet,"addVChartProperty",uU),t.transform({type:"addVChartProperty",options:{beforeCall:AU.bind(this),call:kU}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(LZ.mark.sunburst,{isSeriesMark:!0,customShape:null===(t=this._spec.sunburst)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.sunburst)||void 0===e?void 0:e.stateSort});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},gV.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(LZ.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},gV.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new EZ(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(V(this.__innerRadius))[0],outerRadius:this._computeRadius(V(this.__outerRadius))[0],startAngle:V(this._startAngle)[0],endAngle:V(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(wU(null===(e=MN.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),TU(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(wU(null===(e=MN.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),TU(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return _(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]}}LZ.type=uL.sunburst,LZ.mark=Oz,N(LZ,RZ);const OZ=()=>{MN.registerSeries(LZ.type,LZ),WX(),bX(),dG(),MN.registerAnimation("sunburst",((t,e)=>({appear:Zq(0,e),enter:Xq(t),exit:qq(t),disappear:qq(t)})))},IZ=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new wZ(i).layout(t,{width:s,height:n})};class DZ extends SW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const FZ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class jZ extends FU{constructor(){super(...arguments),this.type=uL.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:_U),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:Ij},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),JN(this._dataSet,"circlePackingLayout",IZ),JN(this._dataSet,"flatten",TZ),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)||(JN(t.dataSet,"addVChartProperty",uU),t.transform({type:"addVChartProperty",options:{beforeCall:AU.bind(this),call:kU}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(jZ.mark.circlePacking,{isSeriesMark:!0,customShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},gV.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(jZ.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"},gV.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:yU,operations:["max","min","values"]},{key:_U,operations:["values"]}])}initTooltip(){this._tooltipHelper=new DZ(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(wU(null===(i=MN.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),TU(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(wU(null===(e=MN.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),TU(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}jZ.type=uL.circlePacking,jZ.mark=Fz,N(jZ,RZ);const zZ=()=>{MN.registerSeries(jZ.type,jZ),WX(),bX(),cG(),MN.registerAnimation("circlePacking",((t,e)=>({appear:FZ(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},HZ=t=>{let e=0;return t.forEach(((t,i)=>{var s;ma(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=HZ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function NZ(t){return t.depth}function VZ(t,e){return e-1-t.endDepth}const GZ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),WZ=(t,e)=>{if(ma(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(ma(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},UZ={left:NZ,right:VZ,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?Ja(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:NZ,end:VZ},YZ=yo(0,1);class KZ{constructor(t){this._ascendingSourceBreadth=(t,e)=>GZ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>GZ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},KZ.defaultOptions,t);const e=this.options.nodeKey,i=fa(e)?e:e?Yx(e):null;this._getNodeKey=i,this._logger=lo.getInstance(),this._alignFunc=fa(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):UZ[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)};iS(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);return this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!ma(t.source)&&!ma(t.target))),t.targetLinks=t.targetLinks.filter((t=>!ma(t.source)&&!ma(t.target)))})),r=r.filter((t=>!ma(t.source)&&!ma(t.target))),iS(this.options.direction)&&(n.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];HZ(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=ma(t.value)?0:wo(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=Ga(t,["parents"]);if(a.parents=t.parents.map((t=>Ga(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=wo(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!ma(r.source),l=!ma(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&&ma(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=[WZ(s[t.source]),WZ(s[t.target],!0)].filter((t=>!ma(t)));e.length&&(t.value=Ja(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=wo(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=wo(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(Sa(e)){const t=mo(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(wa(e)){if(r=e,wa(i))a=i;else if(ma(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else fa(e)&&wa(i)&&(a=i);const l=[];for(let e=0,i=t.length;e{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/s)}),1/0)}const l="start"===this.options.gapPosition,h=!l&&"end"!==this.options.gapPosition,c=wa(this.options.nodeHeight)?t=>this.options.nodeHeight:fa(this.options.nodeHeight)?this.options.nodeHeight:o>0?t=>o:t=>Math.max(t.value*r,n,0),d=wa(this.options.linkHeight)?()=>this.options.linkHeight:fa(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*YZ(t.value/e.value):0,s,0);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t1&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}ma(this.options.nodeSortBy)&&n.sort(GZ),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(GZ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new KZ(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},$Z=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&$Z(t,e.children,i)}))},qZ=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},ZZ=(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 KZ(e),r=[];return r.push(n.layout(s,i)),r},JZ=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:[]},QZ=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 tJ extends SW{getDefaultTooltipPattern(t,e){switch(t){case"mark":return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},hasShape:!1},content:[{key:this.markTooltipKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]};case"dimension":if(e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},s=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{s.push({seriesId:t.id,key:this.markTooltipKeyCallback,value:this.markTooltipValueCallback,hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:s}}}return null}}const eJ=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),iJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:eJ(t),sJ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class nJ extends eG{constructor(){super(...arguments),this.type=nJ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}nJ.type="linkPath";const rJ=()=>{EO.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(KD).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),EO.registerAnimationType("linkPathGrowIn",XD),EO.registerAnimationType("linkPathGrowOut",$D),EO.registerAnimationType("linkPathUpdate",qD),OD(),ED(),MN.registerMark(nJ.type,nJ)};class aJ extends FU{constructor(){super(...arguments),this.type=uL.sankey,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new wt,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&s.mark.id().includes("node")?this._handleNodeAdjacencyClick(s):s&&s.mark.id().includes("link")?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&s.mark.id().includes("node")?this._handleNodeRelatedClick(s):s&&s.mark.id().includes("link")?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e,i;const s=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!s||!s.length)return;const n=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!n||!n.length)return;const r=null===(i=this._labelMark)||void 0===i?void 0:i.getProductElements();if(!r||!r.length)return;const a=[gV.STATE_SANKEY_EMPHASIS,gV.STATE_SANKEY_EMPHASIS_REVERSE];s.forEach((t=>{t.removeState(a)})),n.forEach((t=>{t.removeState(a)})),r.forEach((t=>{t.removeState(a)}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum(),r=(null==n?void 0:n.parents)?"parents":"source";if(V(n[r]).includes(e.key)){let s;if(i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),"parents"===r){const t=n.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;s=i/n.value}t.removeState(gV.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(gV.STATE_SANKEY_EMPHASIS),t.addState(gV.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(gV.STATE_SANKEY_EMPHASIS),t.addState(gV.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(gV.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(gV.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(gV.STATE_SANKEY_EMPHASIS),e.addState(gV.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),i)},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;if("source"===((null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(V(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(gV.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(gV.STATE_SANKEY_EMPHASIS)):(t.removeState(gV.STATE_SANKEY_EMPHASIS),t.addState(gV.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(V(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const r=s.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return s.removeState(gV.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(gV.STATE_SANKEY_EMPHASIS),void s.addState(gV.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),s.removeState(gV.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(gV.STATE_SANKEY_EMPHASIS),void s.addState(gV.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(gV.STATE_SANKEY_EMPHASIS),s.addState(gV.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),t)}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[gV.STATE_SANKEY_EMPHASIS,gV.STATE_SANKEY_EMPHASIS_REVERSE];if(this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)})),this._labelMark){const e=this._labelMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e.removeState(t)}))}}else{const e=t.getDatum(),n=[e.source,e.target],r=[];V(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(gV.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(gV.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(gV.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(gV.STATE_SANKEY_EMPHASIS),void t.addState(gV.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(gV.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(gV.STATE_SANKEY_EMPHASIS),void t.addState(gV.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(gV.STATE_SANKEY_EMPHASIS),t.addState(gV.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n),this._labelMark&&this._highLightElements(this._labelMark.getProductElements(),n)}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){JN(this._dataSet,"sankeyLayout",ZZ),JN(this._dataSet,"sankeyFormat",qZ),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap},level:cV.sankeyLayout});const{dataSet:a}=this._option;JN(a,"sankeyNodes",JZ),JN(a,"flatten",TZ);const o=new Mr(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:xU.bind(this),call:SU}},!1),this._nodesSeriesData=new vU(this._option,o),JN(a,"sankeyLinks",QZ);const l=new Mr(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:xU.bind(this),call:SU}},!1),this._linksSeriesData=new vU(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(aJ.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:null===(t=this._spec.node)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.node)||void 0===e?void 0:e.stateSort});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(aJ.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:null===(i=this._spec.link)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.link)||void 0===s?void 0:s.stateSort});if(r&&(this._linkMark=r),this._spec.label&&this._spec.label.visible){const t=this._createMark(aJ.mark.label,{dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=V(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=V(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const e=this._nodeMark;e&&this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:this._fillByNode},gV.STATE_NORMAL,t.AttributeLevel.Mark)}_initLinkMarkStyle(){var e;const i=this._linkMark;i&&this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:this._fillByLink,direction:null!==(e=this._spec.direction)&&void 0!==e?e:"horizontal"},gV.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},gV.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},gV.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},gV.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},gV.STATE_NORMAL,t.AttributeLevel.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},gV.STATE_NORMAL,t.AttributeLevel.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},gV.STATE_NORMAL,t.AttributeLevel.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},gV.STATE_NORMAL,t.AttributeLevel.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},gV.STATE_NORMAL,t.AttributeLevel.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},gV.STATE_NORMAL,t.AttributeLevel.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:this._fillByNode,text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},gV.STATE_NORMAL,t.AttributeLevel.Series),this._labelMark.setZIndex(this._labelLayoutZIndex))}_createText(t){var e;if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,s,n;const r={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(wU(null===(i=MN.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),TU("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(wU(null===(s=MN.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),TU("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(wU(null===(n=MN.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),TU("label",this._spec,this._markAttributeContext)))}initEvent(){var e,i,s;super.initEvent(),null===(e=this._nodesSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(i=this._linksSeriesData.getDataView())||void 0===i||i.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=null!==(s=this._spec.emphasis)&&void 0!==s?s:{};if(!0!==this._option.disableTriggerEvent&&n.enable&&("adjacency"===n.effect||"related"===n.effect)){const e="hover"===n.trigger?"pointerover":"pointerdown";this.event.on(e,{level:t.Event_Bubble_Level.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([gV.STATE_SANKEY_EMPHASIS_REVERSE,gV.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(gV.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new tJ(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new iH;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t;if(this._nodeList)return this._nodeList;const e=this._rawData.latestData[0],i=(null==e?void 0:e.nodes)?(null===(t=e.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(e.nodes,this._spec.categoryField)):e.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==e?void 0:e.links)?Array.from(this.extractNamesFromLink(e.links)):null==e?void 0:e.values.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=i,i}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return $Z(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}aJ.type=uL.sankey,aJ.mark=Bz;const oJ=()=>{EO.registerTransform("sankey",{transform:XZ,markPhase:"beforeJoin"},!0),GY(),rJ(),bX(),MN.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:iJ(t,e)},hG))),MN.registerAnimation("sankeyLinkPath",((t,e)=>({appear:sJ(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),dG(),MN.registerSeries(aJ.type,aJ)},lJ=(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=TZ(n);return i=gU([{latestData:r}],e),i};class hJ extends SW{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const cJ=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class dJ extends LU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class uJ extends FU{constructor(){super(...arguments),this.type=uL.treemap,this.transformerConstructor=dJ,this._viewBox=new wt,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:_U),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Rt),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:Ij},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[_U,"name"].forEach((e=>{t[e]=t.datum[t.depth][e]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(JN(this._rawData.dataSet,"addVChartProperty",uU),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:AU.bind(this),call:kU}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const t=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return null===(i=this._rawDataStatistics.latestData)||void 0===i?void 0:i[t]}_createHierarchyDataStatistics(t,e){JN(this._dataSet,"hierarchyDimensionStatistics",lJ),JN(this._dataSet,"flatten",TZ);const i=new Mr(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:yU,operations:["max","min","values"]},{key:_U,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(uJ.mark.nonLeaf,{isSeriesMark:!0,customShape:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.stateSort});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(uJ.mark.leaf,{isSeriesMark:!0,customShape:null===(i=this._spec.leaf)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.leaf)||void 0===s?void 0:s.stateSort});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},gV.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()},gV.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},gV.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},gV.STATE_NORMAL,t.AttributeLevel.Series))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},gV.STATE_NORMAL,t.AttributeLevel.Series),"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},gV.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(wU(null===(e=MN.getAnimationInKey("treemap"))||void 0===e?void 0:e(),TU(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 hJ(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(e){const{scale:i,scaleCenter:s}=e;if(1===i)return;this._matrix.reset();const{x:n,y:r}=s;this._matrix.translate(n,r),this._matrix.scale(i,i),this._matrix.translate(-n,-r);const{a:a,b:o,c:l,d:h,e:c,f:d}=this._matrix;this._matrix.multiply(a,o,l,h,c,d),this.disableMarkAnimation(),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}uJ.type=uL.treemap,uJ.mark=Pz,uJ.transformerConstructor=dJ,N(uJ,RZ),N(uJ,OK);const pJ=()=>{GY(),bX(),MN.registerAnimation("treemap",((t,e)=>({appear:cJ(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),dG(),EO.registerTransform("treemap",{transform:oZ,markPhase:"beforeJoin"},!0),MN.registerSeries(uJ.type,uJ)},gJ={type:"fadeIn"};function fJ(t,e){return"fadeIn"===e?gJ:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class mJ extends LU{constructor(){super(...arguments),this._supportStack=!1}}class vJ extends E${constructor(){super(...arguments),this.type=uL.gaugePointer,this.transformerConstructor=mJ,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(vJ.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},vJ.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(vJ.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=W(e),s=U(e),n=lt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(wU(null===(i=MN.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),TU("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}vJ.type=uL.gaugePointer,vJ.mark=Lz,vJ.transformerConstructor=mJ;const yJ=()=>{MN.registerSeries(vJ.type,vJ),CK(),GY(),MN.registerAnimation("gaugePointer",((t,e)=>{const i=fJ(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),d$(),h$()};class _J extends LU{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class bJ extends E${constructor(){super(...arguments),this.type=uL.gauge,this.transformerConstructor=_J,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Tt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();JN(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[qj]=t[this._angleField[0]],t[$j]=e>0?i[e-1][qj]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(bJ.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(bJ.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.min(e+this._padAngle/2,(e+i)/2)}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.max(i-this._padAngle/2,(e+i)/2)}_getAngleValueStartWithoutPadAngle(t){return p(t[$j])?this.angleAxisHelper.dataToPosition([t[$j]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[qj]])}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(wU(null===(i=MN.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),TU("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}bJ.type=uL.gauge,bJ.mark=Rz,bJ.transformerConstructor=_J;class xJ extends WU{constructor(){super(...arguments),this.type=xJ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}xJ.type="cell";const SJ=()=>{MN.registerMark(xJ.type,xJ),Jw(),tT(),EO.registerGraphic(FL.cell,im),EO.registerMark(FL.cell,kj)};function AJ(t){return!1===t?{}:{type:"fadeIn"}}class kJ extends SW{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class MJ extends LU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class wJ extends FU{constructor(){super(...arguments),this.type=uL.heatmap,this.transformerConstructor=MJ}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=V(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(wJ.mark.cell,{morph:PU(this._spec,wJ.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:n,customShape:null===(t=this._spec.cell)||void 0===t?void 0:t.customShape,stateSort:null===(e=this._spec.cell)||void 0===e?void 0:e.stateSort}),this._backgroundMark=this._createMark(wJ.mark.cellBackground,{progressive:n,customShape:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.customShape,stateSort:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.stateSort})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=de(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=DU(this);this._cellMark.setAnimationConfig(wU(null===(i=MN.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),TU("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 kJ(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}wJ.type=uL.heatmap,wJ.mark=jz,wJ.transformerConstructor=MJ;const TJ=()=>{bX(),SJ(),MN.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},hG),{appear:AJ(e)}))),gY(),dY(),MN.registerSeries(wJ.type,wJ)},CJ=(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)||!_(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=Tt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=Tt(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),k=Zx(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Zx(e.outerRadius,A),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Zx(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Zx(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Yx(e.field),C=t.map(T),[E,P]=$x(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?T:Yx(e.radiusField),L=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>L;if(R){const[i,s]=R!==T?$x(t.map(R)):[E,P],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)*(R(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=EJ(I,D,t.length),j=[],z=(D-I)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),PJ({x:n,y:r,size:s},j)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=z,a>D?a=I:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},PJ=(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,[Oj]:null==n?void 0:n[Oj],[Dj]:null==n?void 0:n[Dj]}};class RJ extends eG{constructor(){super(...arguments),this.type=RJ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}RJ.type="ripple";const LJ=()=>{MN.registerMark(RJ.type,RJ),EO.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}})).registerDefaultEncoder((()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}}))),OD(),RD()},OJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class IJ extends LU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class DJ extends LX{constructor(){super(...arguments),this.type=uL.correlation,this.transformerConstructor=IJ,this._viewBox=new wt}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;JN(this._dataSet,"correlation",CJ);const s=new Ar;QN(s,"dataview",br),JN(s,"correlationCenter",BJ);const n=new Mr(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 vU(this._option,n)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var e,i,s,n;const r=this._createMark(DJ.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:Oj,customShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape,stateSort:null===(i=this._spec.nodePoint)||void 0===i?void 0:i.stateSort});r&&(r.setZIndex(t.LayoutZIndex.Node),this._nodePointMark=r);const a=this._createMark(DJ.mark.ripplePoint,{key:Oj,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(DJ.mark.centerPoint,{key:Oj,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape,stateSort:null===(n=this._spec.centerPoint)||void 0===n?void 0:n.stateSort});o&&(o.setZIndex(t.LayoutZIndex.Node),this._centerPointMark=o)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[Pj],y:t=>t[Bj],size:t=>t[Rj],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},gV.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},gV.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},gV.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)},gV.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(wU(null===(e=MN.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),TU("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}DJ.type=uL.correlation,DJ.mark=zz,DJ.transformerConstructor=IJ;const FJ=()=>{YU(),LJ(),MN.registerSeries(DJ.type,DJ),MN.registerAnimation("correlation",((t,e)=>Object.assign({appear:OJ(0,e)},lG)))};class jJ extends eG{constructor(){super(...arguments),this.type=jJ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}jJ.type="liquid";const zJ=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e/2):t;class HJ extends SW{constructor(){super(...arguments),this.getContentKey=()=>t=>this.series.getValueField(),this.getContentValue=()=>t=>t[this.series.getValueField()],this.getLiquidFillColor=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(),value:this.getContentValue(),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getLiquidFillColor,shapeStroke:this.getLiquidFillColor,shapeHollow:!1}]}}}class NJ extends OU{constructor(){super(...arguments),this.type=uL.liquid,this.transformerConstructor=KU,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=dH(this._spec.outlineMargin),this._paddingSpec=dH(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(t),this._heightRatio=mt(...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(NJ.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(NJ.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(NJ.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return zJ(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setInteractive(!1)}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{clip:!0,width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[im({x:e,y:i,size:s,symbolType:zJ(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new HJ(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(wU(null===(i=MN.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),TU("liquid",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=yT(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}NJ.type=uL.liquid,NJ.mark=Nz,NJ.transformerConstructor=KU;const VJ=t=>V(t).join(",");class GJ extends SW{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>VJ(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>VJ(null==t?void 0:t[this.series.getDimensionField()[0]])}}class WJ extends LU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class UJ extends OU{constructor(){super(...arguments),this.type=uL.venn,this.transformerConstructor=WJ,this._viewBox=new wt}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:Ij)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(UJ.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(UJ.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()},gV.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},gV.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},gV.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=>VJ(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)}},gV.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=>VJ(t.sets)},gV.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new GJ(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:VJ(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return VJ(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[VJ(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>V(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(VJ(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(wU(null===(e=MN.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),TU(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(wU(null===(e=MN.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),TU(t.name,this._spec,this._markAttributeContext)))}))}}UJ.type=uL.venn,UJ.mark=Vz,UJ.transformerConstructor=WJ;class YJ extends kY{_isValidSeries(t){return t===uL.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class KJ extends SY{constructor(){super(...arguments),this.transformerConstructor=YJ,this.type="map",this.seriesType=uL.map}}KJ.type="map",KJ.seriesType=uL.map,KJ.transformerConstructor=YJ;class XJ extends kY{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=V(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),_(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 XJ{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=UG(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,VH({},s,l)),n&&Object.assign(o,VH({},n,o))}}class qJ extends XJ{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class ZJ extends XJ{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle})}}class JJ extends SY{constructor(){super(...arguments),this.transformerConstructor=ZJ}}JJ.transformerConstructor=ZJ;class QJ extends JJ{constructor(){super(...arguments),this.transformerConstructor=ZJ,this.type="pie",this.seriesType=uL.pie}}QJ.type="pie",QJ.seriesType=uL.pie,QJ.transformerConstructor=ZJ;class tQ extends ZJ{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class eQ extends JJ{constructor(){super(...arguments),this.transformerConstructor=tQ,this.type="pie3d",this.seriesType=uL.pie3d}}eQ.type="pie3d",eQ.seriesType=uL.pie3d,eQ.transformerConstructor=tQ;class iQ extends qJ{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:OL,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:OL,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=V(t.crosshair||{}).map((t=>VH({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class sQ extends SY{constructor(){super(...arguments),this.transformerConstructor=iQ,this.type="rose",this.seriesType=uL.rose,this._canStack=!0}}sQ.type="rose",sQ.seriesType=uL.rose,sQ.transformerConstructor=iQ;class nQ extends qJ{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:VH({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=V(t.crosshair||{}).map((t=>VH({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class rQ extends SY{constructor(){super(...arguments),this.transformerConstructor=nQ,this.type="radar",this.seriesType=uL.radar,this._canStack=!0}}rQ.type="radar",rQ.seriesType=uL.radar,rQ.transformerConstructor=nQ;class aQ extends kY{_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=>{P(e,"trimPadding")&&VH(e,SV(this.type,t))})),this._transformAxisSpec(t)}}class oQ extends SY{constructor(){super(...arguments),this.transformerConstructor=aQ,this.type="common",this._canStack=!0}}oQ.type="common",oQ.transformerConstructor=aQ;class lQ extends MY{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class hQ extends SY{constructor(){super(...arguments),this.transformerConstructor=lQ,this._canStack=!0}}hQ.transformerConstructor=lQ;class cQ extends lQ{transformSpec(t){super.transformSpec(t),_V(t)}}class dQ extends hQ{constructor(){super(...arguments),this.transformerConstructor=cQ,this.type="histogram",this.seriesType=uL.bar}}dQ.type="histogram",dQ.seriesType=uL.bar,dQ.transformerConstructor=cQ;class uQ extends hQ{constructor(){super(...arguments),this.transformerConstructor=cQ,this.type="histogram3d",this.seriesType=uL.bar3d}}uQ.type="histogram3d",uQ.seriesType=uL.bar3d,uQ.transformerConstructor=cQ;class pQ extends $J{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class gQ extends SY{constructor(){super(...arguments),this.transformerConstructor=pQ,this.type="circularProgress",this.seriesType=uL.circularProgress,this._canStack=!0}}gQ.type="circularProgress",gQ.seriesType=uL.circularProgress,gQ.transformerConstructor=pQ;class fQ extends $J{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:uL.circularProgress})}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===uL.gauge||t.type===uL.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===uL.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 mQ extends SY{constructor(){super(...arguments),this.transformerConstructor=fQ,this.type="gauge",this.seriesType=uL.gaugePointer}}mQ.type="gauge",mQ.seriesType=uL.gaugePointer,mQ.transformerConstructor=fQ;class vQ extends kY{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class yQ extends SY{constructor(){super(...arguments),this.transformerConstructor=vQ,this.type="wordCloud",this.seriesType=uL.wordCloud}}yQ.transformerConstructor=vQ;class _Q extends vQ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class bQ extends yQ{constructor(){super(...arguments),this.transformerConstructor=_Q,this.type="wordCloud",this.seriesType=uL.wordCloud}}bQ.type="wordCloud",bQ.seriesType=uL.wordCloud,bQ.transformerConstructor=_Q;class xQ extends vQ{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class SQ extends yQ{constructor(){super(...arguments),this.transformerConstructor=xQ,this.type="wordCloud3d",this.seriesType=uL.wordCloud3d}}SQ.type="wordCloud3d",SQ.seriesType=uL.wordCloud3d,SQ.transformerConstructor=xQ;class AQ extends kY{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class kQ extends SY{constructor(){super(...arguments),this.transformerConstructor=AQ,this.type="funnel",this.seriesType=uL.funnel}}kQ.type="funnel",kQ.seriesType=uL.funnel,kQ.transformerConstructor=AQ;class MQ extends SY{constructor(){super(...arguments),this.transformerConstructor=AQ,this.type="funnel3d",this.seriesType=uL.funnel3d}}MQ.type="funnel3d",MQ.seriesType=uL.funnel3d,MQ.transformerConstructor=AQ;class wQ extends MY{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=UG(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=UG(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class TQ extends SY{constructor(){super(...arguments),this.transformerConstructor=wQ,this.type="linearProgress",this.seriesType=uL.linearProgress,this._canStack=!0}}TQ.type="linearProgress",TQ.seriesType=uL.linearProgress,TQ.transformerConstructor=wQ;class CQ extends MY{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),_V(t)}}class EQ extends SY{constructor(){super(...arguments),this.transformerConstructor=CQ,this.type="rangeColumn",this.seriesType=uL.rangeColumn}}EQ.type="rangeColumn",EQ.seriesType=uL.rangeColumn,EQ.transformerConstructor=CQ;class PQ extends MY{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class BQ extends SY{constructor(){super(...arguments),this.transformerConstructor=PQ,this.type="rangeColumn3d",this.seriesType=uL.rangeColumn3d}}BQ.type="rangeColumn3d",BQ.seriesType=uL.rangeColumn3d,BQ.transformerConstructor=PQ;class RQ extends kY{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:LL,i=p(t.endAngle)?t.endAngle:e+Ct(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=uL.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class LQ extends SY{constructor(){super(...arguments),this.transformerConstructor=RQ,this.type="sunburst",this.seriesType=uL.sunburst}}LQ.type="sunburst",LQ.seriesType=uL.sunburst,LQ.transformerConstructor=RQ;class OQ extends kY{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=uL.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IQ extends SY{constructor(){super(...arguments),this.transformerConstructor=OQ,this.type="circlePacking",this.seriesType=uL.circlePacking}}IQ.type="circlePacking",IQ.seriesType=uL.circlePacking,IQ.transformerConstructor=OQ;class DQ extends kY{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class FQ extends SY{constructor(){super(...arguments),this.transformerConstructor=DQ,this.type="treemap",this.seriesType=uL.treemap}}FQ.type="treemap",FQ.seriesType=uL.treemap,FQ.transformerConstructor=DQ;class jQ extends $Y{transformSpec(t){super.transformSpec(t),t.legends&&V(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),_V(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class zQ extends qY{constructor(){super(...arguments),this.transformerConstructor=jQ,this.type="waterfall",this.seriesType=uL.waterfall}}zQ.type="waterfall",zQ.seriesType=uL.waterfall,zQ.transformerConstructor=jQ;class HQ extends MY{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),_V(t)}}class NQ extends SY{constructor(){super(...arguments),this.transformerConstructor=HQ,this.type="boxPlot",this.seriesType=uL.boxPlot}}NQ.type="boxPlot",NQ.seriesType=uL.boxPlot,NQ.transformerConstructor=HQ;class VQ extends kY{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class GQ extends SY{constructor(){super(...arguments),this.transformerConstructor=VQ,this.type="sankey",this.seriesType=uL.sankey}_setStateInDatum(t,e,i,s,n){const r=_(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return _(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}GQ.type="sankey",GQ.seriesType=uL.sankey,GQ.transformerConstructor=VQ;class WQ extends MY{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),_V(t)}}class UQ extends SY{constructor(){super(...arguments),this.transformerConstructor=WQ,this.type="rangeArea",this.seriesType=uL.rangeArea}}UQ.type="rangeArea",UQ.seriesType=uL.rangeArea,UQ.transformerConstructor=WQ;class YQ extends MY{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class KQ extends SY{constructor(){super(...arguments),this.transformerConstructor=YQ,this.type="heatmap",this.seriesType=uL.heatmap}}KQ.type="heatmap",KQ.seriesType=uL.heatmap,KQ.transformerConstructor=YQ;class XQ extends kY{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=uL.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class $Q extends SY{constructor(){super(...arguments),this.transformerConstructor=XQ,this.type="correlation",this.seriesType=uL.correlation}}$Q.type="correlation",$Q.seriesType=uL.correlation,$Q.transformerConstructor=XQ;function qQ(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=kN(t.style)),E(t.textStyle)||VH(s.textStyle,kN(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&kN(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&kN(s.background.style),s}const ZQ=(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},JQ=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:Dj;return _(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class QQ extends JU{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:()=>{cR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),cR(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=oH(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=V(s)),p(e)&&(this._regionUserId=V(e)),p(n)&&(this._seriesIndex=V(n)),p(i)&&(this._regionUserIndex=V(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(z(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new JV(this._option,e),this._initSelectedData(),cR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(cR(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)z(s,this._cacheAttrs)||this._legendComponent.setAttributes(VH({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(VH({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i,s;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(VH({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),null===(s=this.getChart())||void 0===s||s.setLayoutTag(!0,null,!1),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}QQ.specKey="legends";class t0 extends QQ{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!_(e))return e.type&&"discrete"!==e.type?void 0:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.discreteLegend}];const i=[];return e.forEach(((t,e)=>{t.type&&"discrete"!==t.type||i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.discreteLegend})})),i}init(t){super.init(t),cR(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:cV.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){JN(this._option.dataSet,"discreteLegendFilter",JQ),JN(this._option.dataSet,"discreteLegendDataMake",ZQ);const t=new Mr(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return cR(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(!Nx(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=uN(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:f,regionIndex:m,seriesIndex:v,seriesId:y,padding:_}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=qQ(s)),E(n.focusIconStyle)||kN(n.focusIconStyle),n.shape&&(n.shape=SN(n.shape)),n.label&&(n.label=SN(n.label)),n.value&&(n.value=SN(n.value)),n.background&&(n.background=SN(n.background)),lH(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),lH(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),lH(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(E(r.railStyle)||kN(r.railStyle),E(r.sliderStyle)||kN(r.sliderStyle)):(E(r.textStyle)||kN(r.textStyle),r.handler&&SN(r.handler)),b.pager=r,a.visible&&!E(a.style)&&(VH(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return _B}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(uB.legendItemClick,(i=>{const s=P(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(uB.legendItemHover,(e=>{const i=P(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(uB.legendItemUnHover,(e=>{const i=P(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}=VG(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=VG(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}t0.specKey="legends",t0.type=r.discreteLegend;const e0=(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[]},i0=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!E(a)){const[e,i]=a;return l(t)?xN(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function s0(t){return"color"===t||"size"===t}const n0={color:kB,size:wB},r0=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],a0=[2,10];class o0 extends QQ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!_(e))return s0(e.type)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:"color"===e.type?r.colorLegend:r.sizeLegend}]:void 0;const i=[];return e.forEach(((t,e)=>{s0(t.type)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:"color"===t.type?r.colorLegend:r.sizeLegend})})),i}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),cR(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:cV.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(){JN(this._option.dataSet,"continuousLegendFilter",i0),JN(this._option.dataSet,"continuousLegendDataMake",e0);const t=new Mr(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>dR(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=uN(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Nx(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=uN(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()),E(a)&&(a="color"===this._legendType?r0:a0);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=VH({},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:y,defaultSelected:_,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:w}=i,T=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&&(T.title=qQ(s)),T.showHandler=!1!==n.visible,E(n.style)||(T.handlerStyle=kN(n.style)),p(r.width)&&(T.railWidth=r.width),p(r.height)&&(T.railHeight=r.height),E(r.style)||(T.railStyle=kN(r.style)),E(a.style)||(T.trackStyle=kN(a.style)),T.startText=SN(o),T.endText=SN(l),T.handlerText=SN(h),E(c)||(T.sizeBackground=kN(c)),d.visible&&!E(d.style)&&(VH(T,d.style),p(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return n0[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",dt((i=>{const s=P(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}o0.specKey="legends",o0.type=r.continuousLegend;class l0{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(i);const a=this._cacheViewSpec;if(u(null==a?void 0:a[this.activeType])||!1===a.visible)return 1;i.tooltipSpec=a,this._updateActualTooltip(e,i),i.tooltipActual=this._cacheActualTooltip;const{title:o,content:l}=this._cacheActualTooltip,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length),tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=VN(n,a,!0))&&void 0!==e?e:[],...null!==(i=PN(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!yR(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}_updateViewSpec(t){const{changePositionOnly:e,model:i,dimensionInfo:s}=t;e&&this._cacheViewSpec||(this._cacheViewSpec=((t,e,i,s)=>{var n,r,a,o,l,h,c;const d=Object.assign(Object.assign({},e),{activeType:t}),{style:u={}}=e;switch(t){case"mark":case"group":if(i){const s=null!==(r=null===(n=i.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==r?r:{};if(p(s.visible)||p(s.activeType)?d.visible=_W(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=_W(e).includes(t):d.visible=!0,d.handler=null!==(o=null!==(a=s.handler)&&void 0!==a?a:e.handler)&&void 0!==o?o:void 0,null===(l=d.handler)||void 0===l?void 0:l.showTooltip)return d}break;case"dimension":if((null==s?void 0:s.length)&&(CW(s).every((t=>{var e;return!_W(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=_W(e).includes("dimension"):d.visible=!0,d.handler=null!==(h=e.handler)&&void 0!==h?h:void 0,null===(c=d.handler)||void 0===c?void 0:c.showTooltip))return d}const g=wW(t,i,s),f=TW(t,i,s),m=VH({},B(e[t]),f),v=g.title,y=PW(void 0,m,u.shape,void 0,v);p(m.title)?m.title=kW(m.title,Object.assign(Object.assign({},v),y)):m.title=kW(v,y,!0);const _=V(g.content);if(p(m.content)){const t=EW(_);m.content=MW(m.content,(e=>PW(e,m,u.shape,t)))}else m.content=MW(_,(t=>PW(void 0,m,u.shape,void 0,t)),!0);return d[t]=Object.assign(Object.assign(Object.assign({},g),m),{activeType:t}),d})(this.activeType,this.component.getSpec(),i,s))}_updateActualTooltip(t,e){var i,s,n,r;const a=this._cacheViewSpec[this.activeType],{changePositionOnly:o}=e;if(!o||!this._cacheActualTooltip){const o=FW(a,t,e),l=!!p(o)&&!1!==RW(a.visible,t,e);this._cacheActualTooltip=Object.assign(Object.assign({},o),{visible:l,activeType:a.activeType,data:t});const{title:h,content:c}=this._cacheActualTooltip;this._cacheActualTooltip.title=null!==(s=null===(i=a.updateTitle)||void 0===i?void 0:i.call(a,h,t,e))&&void 0!==s?s:h,this._cacheActualTooltip.content=null!==(r=null===(n=a.updateContent)||void 0===n?void 0:n.call(a,c,t,e))&&void 0!==r?r:c}}clearCache(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}}class h0 extends l0{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}shouldHandleTooltip(t,e){var i,s;const{tooltipInfo:n}=e;if(u(n))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(s=null==r?void 0:r.activeType)&&void 0!==s?s:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const s=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==s?void 0:s.has(t.model))||t.mark&&(null==s?void 0:s.has(t.mark))}))}}}class c0 extends l0{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:[s],series:n}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("mark"))}getMouseEventData(t,e){var i;let s,n;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,r=i.tooltipHelper,a=null==r?void 0:r.activeTriggerSet.mark,o=null==r?void 0:r.ignoreTriggerSet.mark;(null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark))?s={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e}:((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark)))&&(n=!0)}return{tooltipInfo:s,ignore:n}}}class d0 extends l0{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n,dimensionInfo:r}=t,a=[{datum:V(s),series:n}],o=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:s}=e;if(u(s))return!1;const n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==n?void 0:n.activeType.includes("group"))}getMouseEventData(t,e){var i,s;let n,r;if("series"===(null===(i=t.model)||void 0===i?void 0:i.modelType)){const i=t.model,a=i.tooltipHelper,o=null==a?void 0:a.activeTriggerSet.group,l=null==a?void 0:a.ignoreTriggerSet.group;if((null==o?void 0:o.has(t.model))||(null==o?void 0:o.has(t.mark))){const r=this.component.getSpec()[this.activeType];((null==r?void 0:r.triggerMark)?V(r.triggerMark):[]).includes(null===(s=t.mark)||void 0===s?void 0:s.name)&&(n={mark:t.mark,datum:t.datum,series:i,dimensionInfo:e})}else((null==l?void 0:l.has(t.model))||(null==l?void 0:l.has(t.mark)))&&(r=!0)}return{tooltipInfo:n,ignore:r}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return V(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=V(s)[0][a];return r.filter((t=>t[a]===o))}}const u0=t=>p(t)&&!_(t),p0=t=>p(t)&&_(t);class g0 extends ZU{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=VH({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=_W(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Fx(this._option.mode)||!Ix(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.triggerOff=null!==(h=t.triggerOff)&&void 0!==h?h:t.trigger,t.confine=null!==(c=t.confine)&&void 0!==c?c:"canvas"===t.renderMode,p(t.mark)&&(t.mark.activeType="mark"),p(t.dimension)&&(t.dimension.activeType="dimension"),p(t.parentElement)?y(t.parentElement)&&(t.parentElement=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Ix(this._option.mode)&&(t.parentElement=null==Ox?void 0:Ox.body)}}class f0 extends JU{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=g0,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const r=Ix(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(e))return;if(!t&&this._clickLock)return;const i=this._getMouseEventData(e),{tooltipInfo:{dimension:s},ignore:{mark:n,dimension:r}}=i,a={mark:!1,dimension:!1,group:!1};a.group=this._showTooltipByMouseEvent("group",i,e,t),a.group||(a.mark=this._showTooltipByMouseEvent("mark",i,e,t)),a.mark||a.group||(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t)),Object.values(a).every((t=>!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(e)&&(n&&u0(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&p0(this._cacheInfo)?a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t,!0):p(s)&&(a.dimension=this._showTooltipByMouseEvent("dimension",i,e,t))),a.mark||a.group||a.dimension&&!u(s)||(this._handleChartMouseOut(e),t&&this._clickLock&&(this._clickLock=!1))},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let o;if(n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock&&(this._clickLock=!0));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&_G.globalConfig.uniqueTooltip&&l&&_G.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};let i="dimension";const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n;const r=s;for(i of Object.keys(this.processor))if("dimension"!==i){const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t,r);e.tooltipInfo[i]=s,e.ignore[i]=n}return e},this._hideTooltipByHandler=e=>{var i,s,n,r;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;let a;if(this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:t.Event_Source_Type.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()})),(null===(n=this._spec.handler)||void 0===n?void 0:n.hideTooltip)?a=this._spec.handler.hideTooltip.bind(this._spec.handler):(null===(r=this.tooltipHandler)||void 0===r?void 0:r.hideTooltip)&&(a=this.tooltipHandler.hideTooltip.bind(this.tooltipHandler)),a){const t=a(e);return t||(this._isTooltipShown=!1),t}return 1}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!_(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.tooltip}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.tooltip})})),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n;else{const t="canvas"===s?LW.canvas:LW.dom,n=MN.getComponentPluginInType(t);n||Bx("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r}}_initProcessor(){this.processor={mark:new c0(this),dimension:new h0(this),group:new d0(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=V(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=this._option.mode;e.includes("hover")&&(this._mountEvent("pointermove",{source:"chart"},this._getMouseMoveHandler(!1)),(Dx(i)||Fx(i))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))),e.includes("click")&&(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0)))}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=vW(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}hideTooltip(){const e={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:t.Event_Source_Type.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(e)}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(p0(t)){if(u0(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>wN(t,e[i])))))return!1}else{if(p0(this._cacheInfo))return!1;const e=this._cacheInfo;if(!((null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series))return!1}const s=this._cacheParams;return!u(s)&&!u(e)&&(s.mark===e.mark&&s.model===e.model&&s.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:s}=t;let n;if(p(s.nativeEvent)){const t=s.nativeEvent;n=t.relatedTarget,t.composedPath&&t.composedPath().length>0&&(n=t.composedPath()[0])}else n=s.relatedTarget;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(p(r)&&p(n)&&pe(n,r))return!0}return!1}getVisible(){return!1!==this._spec.visible}}f0.type=r.tooltip,f0.transformerConstructor=g0,f0.specKey="tooltip";var m0,v0;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(m0||(m0={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(v0||(v0={}));const y0={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class _0 extends JU{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},this._handleHoverInEvent=ut((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||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(e,i,s){const n=i?this._handleOutEvent:s?this._handleClickInEvent:this._handleHoverInEvent,r=i?{level:t.Event_Bubble_Level.chart}:{source:t.Event_Source_Type.chart};_(e)?e.forEach((t=>{this.event.on(t,r,n)})):this.event.on(e,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Dx(e)||Fx(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(_(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:t.Event_Source_Type.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:t.Event_Source_Type.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=P(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{y0[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,f=e(d,["strokeOpacity","fillOpacity","opacity"]),m="line"===a.type;let v=m?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},f),m)a.style.stroke=l||h,a.style.lineWidth=P(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=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 t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:P(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{(t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.cartesianCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){BN(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{yR(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:RN(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){if(!this.enable)return;const e=uR(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=tW(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=sW(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=nW(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new XT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new $T(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new IT(e)),null==s||s.add(t)),JG(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}b0.specKey="crosshair",b0.type=r.cartesianCrosshair;const x0=(t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"===(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),f=Et(t,r,p),m=Et(t,r,g),v=Zt([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);v&&(d=lt(Mt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}};class S0 extends _0{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!_(e))return e.categoryField&&!1!==e.categoryField.visible||e.valueField&&!1!==e.valueField.visible?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible)&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.polarCrosshair})})),i}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{yR(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Mt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=uR(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",VH(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=WG(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=WG(s.getSpec())),c.angle=a.angle,c.axis=s,VH(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=VG(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=VG(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:Et(o,s,i),end:Et(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new XT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new ZT(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=el(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},Et(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=x0(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new JT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new qT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=Pt(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},Et(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new IT(e),null==s||s.add(t),i(t)),JG(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}S0.specKey="crosshair",S0.type=r.polarCrosshair;const A0=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>o[t[r]+""]||o[t[r]],t.filter(l)},k0=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{V(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class M0 extends JU{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate()}else cR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),cR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,f=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,f=Math.abs(e-u)/Math.abs(e-t)*p}const m=lt(this._start+g,0,1),v=lt(this._end-f,0,1);this._handleChange(Math.min(m,v),Math.max(m,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?ft(s/n)>=.5:ft(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=ON(t),this._isHorizontal="horizontal"===IN(this._orient)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!mR(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=V(i.userId)),p(i.specIndex)&&(this._seriesIndex=V(i.specIndex))),p(this._spec.seriesId)){const t=V(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=V(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(V(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=V(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(mR(this._stateScale.type));this._stateScale.domain(e,!0),this._handleChange(this._start,this._end,!0),this._spec.auto&&(this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[U(t),W(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};cR(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=mR(c.getScale(0).type);t.push(n.getRawData());const u=n.getSpec(),p=V(u.xField),g=V(u.yField),f="cartesian"===n.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,m="cartesian"===n.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(s[n.id]="link"===n.type?"from_xField":h===o?f:m,e.push(s[n.id]),this._valueField){const t="link"===n.type?"from_yField":c===o?f:m;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else cR(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;QN(s,"dataview",br),JN(s,"dataFilterComputeDomain",k0);const n=new Mr(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new JV(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=I({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=I({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=I({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(mR(e.type))return this._isReverse()?i[0]+(i[1]-i[0])*(1-t):i[0]+(i[1]-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(s[1]-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&mR(e.type)&&(s=s.slice().reverse()),(i-s[0])/(s[1]-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?this._spec.end:this.dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this.dataToStatePoint(this._spec.startValue):0,s=this._spec.end?this._spec.end:this._spec.endValue?this.dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(s),this._start=i,this._end=s,this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,mR(this._stateScale.type)&&this._stateScale.domain()[0]!==this._stateScale.domain()[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=mR(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[U(e),W(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new zR,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(JN(this._option.dataSet,"dataFilterWithNewDomain",A0),cR(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>mR(this._stateScale.type)},level:cV.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||z(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(mR(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(e,i,s){super.onLayoutStart(e,i,s);const n=this._autoUpdate(e),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:t.AttributeLevel.Built_In}),this._dataUpdating=!1}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&yR(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,yR(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),p?this.show():this.hide(),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}N(M0,OK);class w0 extends ZU{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=VH({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}}}class T0 extends M0{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!_(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.dataZoom}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.dataZoom})})),i}constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=w0,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new aL;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2];this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,this._computeWidth()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,this._computeHeight()-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[U(e),W(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!mR(t.type)||e[0]!==e[1])&&(!yR(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(V(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new uP(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this._statePointToData(e),a=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:kN(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:kN(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:kN(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:kN(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:kN(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:kN(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:kN(g.style)},selectedBackgroundStyle:kN(this._spec.selectedBackground.style),dragMaskStyle:kN(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:VH(kN(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},kN(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:VH(kN(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},kN(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}=VG(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}T0.type=r.dataZoom,T0.transformerConstructor=w0,T0.specKey="dataZoom";class C0 extends M0{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!_(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.scrollBar}];const i=[];return e.forEach(((t,e)=>{i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.scrollBar})})),i}constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new dT(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=iR(this._start,e)&&iR(this._end,i);if(this._shouldChange&&!n){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._statePointToData(e),r=this._statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this._statePointToData(e),this._statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=kN(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=kN(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}C0.type=r.scrollBar,C0.specKey="scrollBar";const E0=(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}),V(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class P0 extends JU{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==P0.type)return null;const e=t[this.specKey];if(!_(e))return!1===e.visible?[]:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.indicator}];const i=[];return e.forEach(((t,e)=>{t&&!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.indicator})})),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=V(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){JN(this._option.dataSet,"indicatorFilter",E0);const t=new Mr(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 JV(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:s,y:n}=t.getLayoutStartPoint(),r=[];return V(this._spec.content).forEach((t=>{const e=VH({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},kN(e.style)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:s,y:n,dx:this._spec.offsetX?pH(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?pH(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!p(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,fitStrategy:this._spec.title.fitStrategy,style:Object.assign(Object.assign({},kN(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new EB(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}P0.type=r.indicator,P0.specKey="indicator";const B0=["sum","average","min","max","variance","standardDeviation","median"];function R0(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=U(s),r=W(s);return er}function L0(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&R0(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=lH(t.x)?F0(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function O0(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&R0(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=lH(t.y)?F0(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function I0(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&R0(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function D0(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&R0(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function F0(t,e){return Number(t.substring(0,t.length-1))*e/100}function j0(t){return B0.includes(t)}function z0(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,f=s.getXAxisHelper().getScale(0).domain(),m=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=L0(t,f,n,d,h,a),i=O0(t,m,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=L0(t,f,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=O0(t,m,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function H0(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=I0(t,l,n,r),i=D0(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=I0(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=D0(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function N0(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=lH(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=lH(i)?Number(i.substring(0,i.length-1))*f/100:i)}const y=d.getXAxisHelper().getScale(0).domain(),_=d.getYAxisHelper().getScale(0).domain(),b=V(t.x),x=V(t.y);1===b.length&&S(b[0])&&R0(y,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])&&R0(_,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+m,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function V0(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=V(t.angle),u=V(t.radius);1===d.length&&S(d[0])&&R0(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])&&R0(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function G0(t,e,i){if(i){const i=e.getRegion(),{x:s,y:n}=i.getLayoutStartPoint(),{width:r,height:a}=i.getLayoutRect();return t.map((t=>{let{x:e,y:i}=t;return lH(e)&&(e=F0(e,r)),e+=s,lH(i)&&(i=F0(i,a)),i+=n,{x:e,y:i}}))}const{width:s,height:n}=e.getOption().getChart().getViewRect();return t.map((t=>{let{x:e,y:i}=t;return lH(e)&&(e=F0(e,s)),lH(i)&&(i=F0(i,n)),{x:e,y:i}}))}function W0(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 U0(t,i){const{labelBackground:s={},style:n,shape:r}=t,a=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=a;return(null==r?void 0:r.visible)?t.shape=Object.assign({visible:!0},kN(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},K0(kN(s.style),i)),p(s.padding)&&(t.padding=de(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=K0(kN(n),i)),t}return{visible:!1}}function Y0(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function K0(t,e){return d(t)?t(e):t}function X0(t,e){return d(t)?t(e):t}function $0(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 q0(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function Z0(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function J0(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Q0(t,e){const i=[];return e.forEach((e=>{const s={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const i=e.x;_(i)?s.x=i.map((i=>e1(i,t,e))):s.x=e1(i,t,e)}if(p(e.y)){const i=e.y;_(i)?s.y=i.map((i=>e1(i,t,e))):s.y=e1(i,t,e)}if(p(e.angle)){const i=e.angle;_(i)?s.angle=i.map((i=>e1(i,t,e))):s.angle=e1(i,t,e)}if(p(e.radius)){const i=e.radius;_(i)?s.radius=i.map((i=>e1(i,t,e))):s.radius=e1(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=e1(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const t1={min:(t,e)=>sR(t[0].latestData,e.field),max:(t,e)=>nR(t[0].latestData,e.field),sum:function(t,e){return rR(t[0].latestData,e.field)},average:function(t,e){return aR(t[0].latestData,e.field)},variance:function(t,e){return oR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(oR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return et(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function e1(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 t1[i](e,{field:s})}return t}class i1 extends JU{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(E(e))return;if(!_(e)&&!1!==e.visible&&this._getMarkerCoordinateType(e)===this.coordinateType)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:this.type}];const i=[];return V(e).forEach(((t,e)=>{!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:this.type})})),i}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&j0(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){var e;let i;return(null!==(e=t.coordinates)&&void 0!==e?e:V(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===this.coordinateType){const{xField:s,yField:n}=e.getSpec(),{xFieldDim:r,xFieldIndex:a,yFieldDim:o,yFieldIndex:l}=t;let h=s;p(a)&&(h=V(s)[a]),r&&V(s).includes(r)&&(h=r);let c=n;p(l)&&(c=V(n)[l]),o&&V(n).includes(o)&&(c=o),i=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries()),y(t[h])&&j0(t[h])?i.x={field:h,aggrType:t[h]}:i.x=V(h).map((e=>t[e])),y(t[c])&&j0(t[c])?i.y={field:c,aggrType:t[c]}:i.y=V(c).map((e=>t[e]))}else if("polar"===this.coordinateType){const{valueField:s,categoryField:n}=e.getSpec(),{angleFieldDim:r,angleFieldIndex:a}=t;let o=n;p(a)&&(o=V(n)[a]),r&&V(n).includes(r)&&(o=r);const l=s;i=Object.assign({angle:void 0,radius:void 0},this._getAllRelativeSeries()),y(t[o])&&j0(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=V(o).map((e=>t[e])),y(t[l])&&j0(t[l])?i.radius={field:l,aggrType:t[l]}:i.radius=V(l).map((e=>t[e]))}return i.getRefRelativeSeries=()=>e,i}))}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];V(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ar;return e.registerParser("array",s),new Mr(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=uR(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=hH(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=hH(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return z(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function s1(t,e){return function(t,e,i){const{predict:s}=tS(t,(t=>t[e]),(t=>t[i])),n=sR(t,e),r=nR(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function n1(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 r1 extends i1{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}=q0(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const{label:_={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:K0(kN(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:U0(_,this._markerData),state:{line:Y0(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:Y0(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:Y0(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:Y0(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),labelBackground:Y0(null!==(v=null===(m=null===(f=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===f?void 0:f.labelBackground)||void 0===m?void 0:m.state)&&void 0!==v?v:{},this._markerData)},animation:null!==(y=this._spec.animation)&&void 0!==y&&y,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:kN(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:kN(x.style)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=W0([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=q0(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;JN(this._option.dataSet,"markerAggregation",Q0),JN(this._option.dataSet,"markerRegression",s1),JN(this._option.dataSet,"markerFilter",n1);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Mr(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}}r1.specKey="markLine";class a1 extends r1{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new JP(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:y}=q0(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=z0(i,s,n,r,d);_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=N0(i,r,d,e.coordinatesOffset):c&&(_=G0(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let f;if(lH(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));f=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));f=Number(g.substring(0,g.length-1))*n/100}}else f=g;const{points:m,label:v,limitRect:y}=l,_=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}(m[0],m[1],u,f);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(m[0],m[1],u,f)),{refX:0,refY:0}),k(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),k(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),k(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),k(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[_[0],_[1]],[_[1],_[2]],[_[2],_[3]]]:_,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:y,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=q0(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 Mr(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}a1.type=r.markLine,a1.coordinateType="cartesian";class o1 extends r1{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=q0(this._spec);return e||i?new eB(t):new JP(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}=q0(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=H0(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=>Et(f,t.radius,t.angle)))}}else u&&(p=V0(i,r,a),g={points:p.map((t=>Et(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=q0(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}}}o1.type=r.polarMarkLine,o1.coordinateType="polar";class l1 extends JU{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=oH(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||!1===e.visible)return null;if(!_(e))return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.title}];const i=[];return e.forEach(((t,e)=>{!1!==t.visible&&i.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.title})})),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)!==(null==t?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o,l;const h=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return Object.assign(Object.assign({},D(this._spec,["padding"])),{textType:null!==(e=this._spec.textType)&&void 0!==e?e:"text",text:null!==(i=this._spec.text)&&void 0!==i?i:"",subtextType:null!==(s=this._spec.subtextType)&&void 0!==s?s:"text",subtext:null!==(n=this._spec.subtext)&&void 0!==n?n:"",x:null!==(r=this._spec.x)&&void 0!==r?r:0,y:null!==(a=this._spec.y)&&void 0!==a?a:0,width:h,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(o=this._spec.align)&&void 0!==o?o:"left",verticalAlign:null!==(l=this._spec.verticalAlign)&&void 0!==l?l:"top",textStyle:Object.assign({width:h},this._spec.textStyle),subtextStyle:Object.assign({width:h},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new TB(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}}l1.type=r.title,l1.specKey=r.title;class h1 extends i1{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Z0(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:K0(kN(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:U0(u,this._markerData),state:{area:Y0(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:Y0(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:Y0(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=W0([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Z0(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();JN(this._option.dataSet,"markerAggregation",Q0),JN(this._option.dataSet,"markerFilter",n1);const c=new Mr(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}h1.specKey="markArea";class c1 extends h1{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new tB(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=Z0(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=z0(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=z0(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=N0(i,r,d,e.coordinatesOffset):c&&(u=G0(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Z0(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}}}c1.type=r.markArea,c1.coordinateType="cartesian";class d1 extends h1{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Z0(this._spec);return i||e||s?new iB(t):new tB(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}=Z0(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=H0(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=V0(i,r,c),u={points:d.map((t=>Et(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Z0(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}}}d1.type=r.polarMarkArea,d1.coordinateType="polar";const u1=t=>kN(Object.assign({},t)),p1=t=>Object.assign(Object.assign({},t),{style:Object.assign({},kN(t.style))}),g1=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=u1(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=u1(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:{},kN(Object.assign({},_)));var _;const b=p1(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=p1(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=p1(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=p1(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:y}),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},f1=t=>"left"===t||"right"===t,m1=t=>"top"===t||"bottom"===t;class v1 extends JU{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({},g1(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({},g1(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?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new GB(t):this._playerComponent=new YB(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(...V(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...V(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...V(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...V(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=f1(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=f1(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...V(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...V(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...V(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...V(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(FB.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(FB.change,(e=>{const{index:i}=e.detail,s=this._specs[i];V(s.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(FB.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(FB.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(FB.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(FB.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return u(e)?null:[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.player}]}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=f1(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=m1(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):f1(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))):m1(this._orient)?this._maxSize():t.height}_computeDx(t){return f1(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return m1(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}v1.specKey="player",v1.type=r.player;class y1 extends JU{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}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_delegateLabelEvent(t){0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}y1.type=r.label;class _1 extends _X{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}}_1.type="text",_1.constructorType="label";const b1=()=>{MN.registerMark(_1.constructorType,_1),LD()};class x1 extends ZU{_initTheme(t,e){return{spec:t,theme:this._theme}}}class S1 extends y1{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=x1,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(t.VGRAMMAR_HOOK_EVENT.AFTER_MARK_RENDER_END,e)}}afterCompile(){this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),cR(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const t=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});t&&(t.setSkipBeforeLayouted(!0),this._marks.addMark(t),this._labelComponentMap.set(t,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:t.baseMark.getSupport3d()});s&&(s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])),t.labelMark.setComponent(s))}))}))}_initTextMarkStyle(){this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r,void 0),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e}=a,i=e.getRule(),o=this._interactiveConfig(t),l=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0,h=VH({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},function(t,e){var i;const{labelSpec:s}=e;return s.overlap&&!g(s.overlap)&&(s.overlap={}),(null!==(i=tX[t])&&void 0!==i?i:tX.point)(e)}(i,a),Object.assign(Object.assign(Object.assign({},D(t,["position","style","state","type"])),o),{centerOffset:l}));return"line"!==i&&"area"!==i||(h.type=i),h}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:eX(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t)();let s;s=_(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:s}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this,labelInfo:i}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}S1.type=r.label,S1.specKey="label",S1.transformerConstructor=x1;class A1 extends y1{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[Yj]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}afterCompile(){this._marks.forEach(((e,i)=>{const s=e.getProduct();s&&s.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&this._delegateLabelEvent(s.getGroupGraphicItem())}))}))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return VH({textStyle:{pickable:!0===this._spec.interactive},position:k1(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[Xj]))},a))}})).encode((e=>eX({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function k1(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}A1.type=r.totalLabel,A1.specKey="totalLabel";class M1 extends i1{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=J0(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,w,T,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:L,image:O,richText:I}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:X0(E.offsetX,this._relativeSeries.getRegion()),offsetY:X0(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:K0(B.style,this._markerData)},state:{line:Y0(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:Y0(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:Y0(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:Y0(null!==(f=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==f?f:{},this._markerData),image:Y0(null!==(v=null===(m=this._spec.itemContent.image)||void 0===m?void 0:m.state)&&void 0!==v?v:{},this._markerData),text:Y0(null!==(_=null===(y=this._spec.itemContent.text)||void 0===y?void 0:y.state)&&void 0!==_?_:{},this._markerData),textBackground:Y0(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData),richText:Y0(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:Y0(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:Y0(null!==(T=null===(w=this._spec.targetSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==L?void 0:L.style)&&(F.itemContent.symbolStyle=kN(K0(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=K0(O.style,this._markerData)),R&&(F.itemContent.textStyle=U0(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=K0(I.style,this._markerData));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:kN(z.style)}):{visible:!1};return new nB(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=W0([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:$0(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:$0(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}=J0(t);if(!(p(t.coordinate)||e||i||s))return;JN(this._option.dataSet,"markerAggregation",Q0),JN(this._option.dataSet,"markerFilter",n1);const{options:n}=this._computeOptions(),r=new Mr(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}M1.specKey="markPoint";class w1 extends M1{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=z0(i,s,s,s,o)[0][0]:r?l=N0(i,s,o,e.coordinatesOffset)[0]:a&&(l=G0([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=J0(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}}}w1.type=r.markPoint,w1.coordinateType="cartesian";class T1 extends M1{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=H0(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:Et({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}])]}}}T1.type=r.polarMarkPoint,T1.coordinateType="polar";class C1 extends M1{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}])]}}}C1.type=r.geoMarkPoint,C1.coordinateType="geo";const E1="inBrush",P1="outOfBrush";class B1 extends JU{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),E1,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),P1,t.AttributeLevel.Series))}))}))}static getSpecInfo(t){const e=t[this.specKey];if(!u(e)&&!1!==e.visible)return[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new qB(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:kN(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(WB.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(WB.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(WB.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,P1),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(WB.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(WB.brushClear,(s=>{this._initMarkBrushState(i,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._handleBrushChange(t.ChartEvent.brushClear,e,s),this._emitEvent(t.ChartEvent.brushChange,e),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(WB.drawEnd,(i=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)})),a.addEventListener(WB.moveEnd,(i=>{const{operateMask:s}=i.detail;this._handleBrushChange(t.ChartEvent.brushEnd,e,i),this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},kN(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(E1),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(E1),i.addState(P1),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(E1),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(E1),i.addState(P1),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,f=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const m=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let y=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=V(t)[0]/2;return y=[{x:m-i,y:v-i},{x:m+i,y:v-i},{x:m+i,y:v+i},{x:m-i,y:v+i}],ce(f,y)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return y=[{x:m,y:v},{x:m+r,y:v},{x:m+r,y:v+a},{x:m,y:v+a}],ce(f,y)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(h,c,["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=u-e.getLayoutStartPoint()[d],o=p-e.getLayoutStartPoint()[d],l=(r-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],h=(o-i[0])/(i[1]-i[0])*(s[1]-s[0])+s[0],c=this._stateClamp(l-a),g=this._stateClamp(h+a);t.getScale().rangeFactor([c,g]),t.effect.scaleUpdate(),this._zoomRecord.push({operateComponent:t,start:c,end:g})}}))}}_bindRegions(){p(this._spec.regionId)&&p(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}_bindLinkedSeries(){p(this._spec.brushLinkSeriesId)&&p(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(V(this._spec.brushLinkSeriesId),V(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?V(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?V(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&V(t).includes(n.userId.toString())||e&&V(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(E1),i.removeState(P1),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return z(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}B1.type=r.brush,B1.specKey="brush";class R1 extends JU{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?_(e)?e.map(((t,e)=>({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:r.customMark}))):[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${gL}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(n.hasAnimation&&t.animation){const e=wU({},TU(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return z(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}afterCompile(){this.getMarks().forEach((e=>{const i=e.getProduct();i&&i.addEventListener(t.VGRAMMAR_HOOK_EVENT.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout){const t=i.getGroupGraphicItem();0===t.listenerCount("*")&&t.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}}))}))}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new wt).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new wt;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}R1.type=r.customMark,R1.specKey="customMark";function L1(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function O1(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function I1(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:O1(t.rect),anchorCandidates:N1(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>L1(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tL1(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function D1(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=ne(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=z1(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=_e(r,s,i);if(!z1(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],F1(j1(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=F1(j1(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=H1(t.rect,a,0),t}));return I1(h)}function F1(t){return t>180?t-360:t}function j1(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function z1(t,e){for(let i=0;i{const{x:r,y:a}=H1(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class V1 extends JU{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!p(e.series)?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.mapLabel}]:null}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new Mr(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:cV.copyDataView},!1),this._data=new JV(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const e=this._spec.trigger;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new nB({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let f=0,m=0,v=0,y=0,_=0;const b=this._spec.position||"top",x=this._spec.offset,S=dH(null===(i=this._spec.background)||void 0===i?void 0:i.padding),A=this._spec.space||0;m+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const k={},M=this.dataToPosition(t),w=rg({});if(w.name=`${this.name}_marker_itemContainer_${e}`,k.container=w,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=lm(kN(Object.assign({},this._spec.background.style)));t.setAttributes(M),k.labelBackground=t,w.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=im(kN(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;k.icon=t,w.appendChild(t),_=i,y+=s,f++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=qg(kN(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;k.nameLabel=e,w.appendChild(e),_=Math.max(_,s),y+=n,f++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=qg(kN(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;k.valueLabel=e,w.appendChild(e),_=Math.max(_,s),y+=n,f++}const T=Object.values(k).find((t=>!!t&&"group"!==t.type)),C={x:null==T?void 0:T.getComputedAttribute("x"),y:null==T?void 0:T.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=m+y+(f-1)*A,E.height=v+_;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=H1(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:k}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+r,y:g}),f+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(f+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const m=this._data.getLatestData()[r],v=this.dataToPosition(m),y=this.getRegions()[0].getLayoutStartPoint(),_=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:y.x,y:y.y,position:v,visible:this._activeDatum.includes(m),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:_,type:"type-po",lineStyle:kN(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):I1(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}V1.type=r.mapLabel,V1.specKey="mapLabel";class G1{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>W1(t))),a=n.filter((t=>!W1(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>W1(t))),h=o.filter((t=>!W1(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 W1(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}G1.type="grid";_G.useRegisters([()=>{yF(),_F(),GU(),YU(),pG(),cG(),gY(),dY(),MN.registerSeries(yY.type,yY),MN.registerChart(TY.type,TY)},()=>{yF(),_F(),GU(),EY(),YU(),BY(),gY(),dY(),MN.registerSeries(LY.type,LY),MN.registerChart(IY.type,IY)},()=>{XY(),MN.registerChart(qY.type,qY)},()=>{hK(),MN.registerChart(dK.type,dK)},()=>{XX(),MN.registerChart(QJ.type,QJ)},()=>{p$(),MN.registerChart(sQ.type,sQ)},()=>{x$(),MN.registerChart(rQ.type,rQ)},()=>{XY(),MN.registerChart(dQ.type,dQ)},()=>{HK(),MN.registerChart(KJ.type,KJ)},()=>{yJ(),MN.registerSeries(bJ.type,bJ),WX(),R$(),h$(),MN.registerChart(mQ.type,mQ)},()=>{xq(),MN.registerChart(bQ.type,bQ)},()=>{Nq(),MN.registerChart(kQ.type,kQ)},()=>{dX(),MN.registerChart(zQ.type,zQ)},()=>{vX(),YU(),cG(),gY(),dY(),MN.registerSeries(yX.type,yX),MN.registerChart(NQ.type,NQ)},()=>{MN.registerSeries(O$.type,O$),WX(),R$(),dG(),d$(),h$(),MN.registerChart(gQ.type,gQ)},()=>{N$(),MN.registerChart(TQ.type,TQ)},()=>{EX(),MN.registerChart(EQ.type,EQ)},()=>{EY(),gY(),dY(),MN.registerSeries(RX.type,RX),MN.registerChart(UQ.type,UQ)},()=>{OZ(),MN.registerChart(LQ.type,LQ)},()=>{zZ(),MN.registerChart(IQ.type,IQ)},()=>{pJ(),MN.registerChart(FQ.type,FQ)},()=>{oJ(),MN.registerChart(GQ.type,GQ)},()=>{TJ(),MN.registerChart(KQ.type,KQ)},()=>{FJ(),MN.registerChart($Q.type,$Q)},()=>{MN.registerChart(oQ.type,oQ)},dY,gY,()=>{sY(),MN.registerComponent(fY.type,fY)},()=>{sY(),MN.registerComponent(mY.type,mY)},()=>{sY(),MN.registerComponent(vY.type,vY)},d$,h$,()=>{MN.registerComponent(t0.type,t0)},()=>{MN.registerComponent(o0.type,o0)},()=>{MN.registerComponent(f0.type,f0)},()=>{MN.registerComponent(b0.type,b0)},()=>{MN.registerComponent(S0.type,S0)},()=>{MN.registerComponent(T0.type,T0)},()=>{MN.registerComponent(C0.type,C0)},()=>{MN.registerComponent(P0.type,P0)},FK,()=>{MN.registerComponent(a1.type,a1),ZP()},()=>{MN.registerComponent(c1.type,c1),QP()},()=>{MN.registerComponent(w1.type,w1),sB()},()=>{MN.registerComponent(o1.type,o1),eB._animate=LP,ZP()},()=>{MN.registerComponent(d1.type,d1),iB._animate=IP,QP()},()=>{MN.registerComponent(T1.type,T1),sB()},()=>{MN.registerComponent(C1.type,C1),sB()},()=>{MN.registerComponent(l1.type,l1)},()=>{MN.registerComponent(v1.type,v1)},()=>{eF(),b1(),tY(),MN.registerComponent(S1.type,S1,!0)},()=>{eF(),b1(),tY(),MN.registerComponent(A1.type,A1,!0)},()=>{MN.registerComponent(B1.type,B1)},()=>{MN.registerComponent(R1.type,R1)},()=>{MN.registerComponent(V1.type,V1)},()=>{Bc.load(YT)},()=>{MN.registerLayout(G1.type,G1)},dU,qO,$O]),_G.useRegisters([()=>{lM(Bc)}]),t.ARC_END_ANGLE=wL,t.ARC_K=TL,t.ARC_MIDDLE_ANGLE=CL,t.ARC_QUADRANT=EL,t.ARC_RADIAN=PL,t.ARC_RATIO=kL,t.ARC_START_ANGLE=ML,t.ARC_TRANSFORM_VALUE=AL,t.AxisSyncPlugin=DG,t.BASE_EVENTS=Mj,t.CORRELATION_SIZE=Rj,t.CORRELATION_X=Pj,t.CORRELATION_Y=Bj,t.CanvasTooltipHandler=cU,t.DEFAULT_CHART_HEIGHT=mL,t.DEFAULT_CHART_WIDTH=fL,t.DEFAULT_CONICAL_GRADIENT_CONFIG=iz,t.DEFAULT_DATA_INDEX=Oj,t.DEFAULT_DATA_KEY=Ij,t.DEFAULT_DATA_SERIES_FIELD=Dj,t.DEFAULT_GRADIENT_CONFIG=sz,t.DEFAULT_LABEL_ALIGN=yL,t.DEFAULT_LABEL_LIMIT=vL,t.DEFAULT_LABEL_TEXT=_L,t.DEFAULT_LABEL_VISIBLE=bL,t.DEFAULT_LABEL_X=xL,t.DEFAULT_LABEL_Y=SL,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=tz,t.DEFAULT_MEASURE_CANVAS_ID=Lj,t.DEFAULT_RADIAL_GRADIENT_CONFIG=ez,t.DEFAULT_SERIES_STYLE_NAME=Fj,t.DomTooltipHandler=hU,t.Factory=MN,t.FormatterPlugin=CG,t.GradientType=Qj,t.MediaQuery=kG,t.POLAR_DEFAULT_RADIUS=OL,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=RL,t.POLAR_START_ANGLE=LL,t.POLAR_START_RADIAN=BL,t.PREFIX=gL,t.SEGMENT_FIELD_END=qj,t.SEGMENT_FIELD_START=$j,t.STACK_FIELD_END=Nj,t.STACK_FIELD_END_OffsetSilhouette=Uj,t.STACK_FIELD_END_PERCENT=Gj,t.STACK_FIELD_KEY=zj,t.STACK_FIELD_START=Hj,t.STACK_FIELD_START_OffsetSilhouette=Wj,t.STACK_FIELD_START_PERCENT=Vj,t.STACK_FIELD_TOTAL=Yj,t.STACK_FIELD_TOTAL_PERCENT=Kj,t.STACK_FIELD_TOTAL_TOP=Xj,t.ThemeManager=aN,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=_G,t.WaterfallDefaultSeriesField=Ej,t.builtinThemes=$H,t.computeActualDataScheme=$z,t.darkTheme=IH,t.dataScheme=gH,t.default=_G,t.defaultThemeName=qH,t.getActualColor=Zz,t.getColorSchemeBySeries=eH,t.getDataScheme=Xz,t.getMergedTheme=nN,t.getTheme=eN,t.hasThemeMerged=QH,t.isColorKey=Jz,t.isProgressiveDataColorScheme=Qz,t.isTokenKey=RH,t.lightTheme=OH,t.queryColorFromColorScheme=qz,t.queryToken=BH,t.registerCanvasTooltipHandler=dU,t.registerChartPlugin=AG,t.registerDomTooltipHandler=()=>{lU(hU)},t.registerFormatPlugin=()=>{AG(CG)},t.registerMediaQuery=()=>{AG(kG)},t.registerTheme=tN,t.removeTheme=iN,t.themeExist=sN,t.themes=ZH,t.token=LH,t.transformColorSchemeToStandardStruct=tH,t.version="1.11.5",t.vglobal=db,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/tools/story-player/package.json b/tools/story-player/package.json index fe7576313b..8df9dc7bdc 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -60,6 +60,6 @@ "@visactor/vrender-kits": "0.19.14", "@visactor/vchart": "workspace:1.11.5", "@visactor/vrender": "0.19.14", - "@visactor/vutils": "~0.18.9" + "@visactor/vutils": "~0.18.10" } } \ No newline at end of file